diff options
author | Richard Carson <Rscarson@rogers.com> | 2024-06-17 18:07:48 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-06-18 00:07:48 +0200 |
commit | 257f0273250087bd5080430fe4c780b208d7986c (patch) | |
tree | e488fddde3f9eb095700e8e921385e8a71a202be /ext/url | |
parent | 5dec3fd4b75a59574e5aeed4e927d8e3e0c1c683 (diff) |
docs: Add documentation to a subset of available extensions (#24138)
I was able to use my experience with some of the Deno extensions to
flesh out their documentation a bit
I've provided docs for the following:
- web
- fetch
- net
- webidl
- url
- io
- crypto
- console
---------
Signed-off-by: Richard Carson <Rscarson@rogers.com>
Diffstat (limited to 'ext/url')
-rw-r--r-- | ext/url/README.md | 53 |
1 files changed, 52 insertions, 1 deletions
diff --git a/ext/url/README.md b/ext/url/README.md index 519c2823e..ba2bbb4d3 100644 --- a/ext/url/README.md +++ b/ext/url/README.md @@ -1,6 +1,57 @@ # deno_url -This crate implements the URL, and URLPattern APIs for Deno. +**This crate implements the URL, and URLPattern APIs for Deno.** URL Spec: https://url.spec.whatwg.org/ URLPattern Spec: https://wicg.github.io/urlpattern/ + +## Usage Example + +From javascript, include the extension's source, and assign `URL`, `URLPattern`, +and `URLSearchParams` to the global scope: + +```javascript +import * as url from "ext:deno_url/00_url.js"; +import * as urlPattern from "ext:deno_url/01_urlpattern.js"; + +Object.defineProperty(globalThis, "URL", { + value: url.URL, + enumerable: false, + configurable: true, + writable: true, +}); + +Object.defineProperty(globalThis, "URLPattern", { + value: url.URLPattern, + enumerable: false, + configurable: true, + writable: true, +}); + +Object.defineProperty(globalThis, "URLSearchParams", { + value: url.URLSearchParams, + enumerable: false, + configurable: true, + writable: true, +}); +``` + +Then from rust, provide `deno_url::deno_url::init_ops_and_esm()` in the +`extensions` field of your `RuntimeOptions` + +## Dependencies + +- **deno_webidl**: Provided by the `deno_webidl` crate + +## Provided ops + +Following ops are provided, which can be accessed through `Deno.ops`: + +- op_url_reparse +- op_url_parse +- op_url_get_serialization +- op_url_parse_with_base +- op_url_parse_search_params +- op_url_stringify_search_params +- op_urlpattern_parse +- op_urlpattern_process_match_input |