-
Notifications
You must be signed in to change notification settings - Fork 366
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Make modules public in http #655
base: main
Are you sure you want to change the base?
Conversation
This allows a user to create it's own module if they dont want http in the root use rquickjs::module::{Declarations, Exports, ModuleDef};
use rquickjs::{Class, Ctx, Result};
pub struct HttpModule;
impl ModuleDef for HttpModule {
fn declare(declare: &Declarations) -> Result<()> {
declare.declare("fetch")?;
declare.declare(stringify!(Request))?;
declare.declare(stringify!(Response))?;
declare.declare(stringify!(Headers))?;
declare.declare("Blob")?;
declare.declare(stringify!(File))?;
declare.declare("default")?;
Ok(())
}
fn evaluate<'js>(ctx: &Ctx<'js>, exports: &Exports<'js>) -> Result<()> {
llrt_utils::module::export_default(ctx, exports, |default| {
llrt_http::fetch::init(ctx, default)?;
Class::<llrt_http::request::Request>::define(default)?;
Class::<llrt_http::response::Response>::define(default)?;
Class::<llrt_http::headers::Headers>::define(default)?;
llrt_http::blob::init(ctx, default)?;
Class::<llrt_http::file::File>::define(default)?;
Ok(())
})?;
Ok(())
}
} |
Personally, I believe that the name |
I can rename the whole folder I agree |
259d1b9
to
00c8e04
Compare
@Sytten can you please rebase and rename the directory? |
@richarddavison I was kinda of waiting to see if we adopted the new module system. |
@Sytten , I think |
Description of changes
Make relevant modules public on llrt_http so people can craft their own module
Checklist
tests/unit
and/or in Rust for my feature if neededmake fix
to format JS and apply Clippy auto fixesmake check
types/
directoryBy submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.