-
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
203 additions
and
66 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,35 @@ | ||
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. | ||
// SPDX-License-Identifier: Apache-2.0 | ||
use rquickjs::{ | ||
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("URL")?; | ||
declare.declare("URLSearchParams")?; | ||
declare.declare("default")?; | ||
Ok(()) | ||
} | ||
|
||
fn evaluate<'js>(ctx: &Ctx<'js>, exports: &mut Exports<'js>) -> Result<()> { | ||
let url_constructor = | ||
Class::<URL>::create_constructor(ctx)?.expect("Could note create URL constructor"); | ||
|
||
let url_search_params_constructor = Class::<URLSearchParams>::create_constructor(ctx)? | ||
.expect("Could note create URLSearchParams constructor"); | ||
|
||
export_default(ctx, exports, |default| { | ||
default.set("URL", url_constructor.clone())?; | ||
default.set("URLSearchParams", url_search_params_constructor.clone())?; | ||
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
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