-
Notifications
You must be signed in to change notification settings - Fork 361
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
10 changed files
with
279 additions
and
137 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -33,6 +33,7 @@ mod security; | |
mod stream; | ||
mod test_utils; | ||
mod timers; | ||
mod url; | ||
mod utils; | ||
mod uuid; | ||
mod vm; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. | ||
// SPDX-License-Identifier: Apache-2.0 | ||
use rquickjs::{ | ||
function::{Constructor, Opt}, | ||
module::{Declarations, Exports, ModuleDef}, | ||
Class, Ctx, Result, | ||
}; | ||
|
||
use crate::{ | ||
http::{url::URL, url_search_params::URLSearchParams}, | ||
module::export_default, | ||
}; | ||
pub struct UrlModule; | ||
|
||
impl ModuleDef for UrlModule { | ||
fn declare(declare: &mut Declarations) -> Result<()> { | ||
declare.declare(stringify!(URL))?; | ||
declare.declare(stringify!(URLSearchParams))?; | ||
|
||
declare.declare("default")?; | ||
Ok(()) | ||
} | ||
|
||
fn evaluate<'js>(ctx: &Ctx<'js>, exports: &mut Exports<'js>) -> Result<()> { | ||
let globals = ctx.globals(); | ||
let url: Constructor = globals.get(stringify!(URL))?; | ||
let urlSearchParams: Constructor = globals.get(stringify!(URLSearchParams))?; | ||
|
||
export_default(ctx, exports, |default| { | ||
default.set(stringify!(URL), url)?; | ||
default.set(stringify!(URLSearchParams), urlSearchParams)?; | ||
Ok(()) | ||
})?; | ||
|
||
Ok(()) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.