refactor(extensions): reintroduce builder (#10412)

This commit is contained in:
Aaron O'Mullan 2021-04-29 00:16:45 +02:00 committed by GitHub
parent e63c533154
commit e89295b176
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
12 changed files with 141 additions and 112 deletions

View file

@ -95,22 +95,22 @@ impl Resource for WebGpuQuerySet {
}
pub fn init(unstable: bool) -> Extension {
Extension::with_ops(
include_js_files!(
Extension::builder()
.js(include_js_files!(
prefix "deno:op_crates/webgpu",
"01_webgpu.js",
"02_idl_types.js",
),
declare_webgpu_ops(),
Some(Box::new(move |state| {
))
.ops(declare_webgpu_ops())
.state(move |state| {
// TODO: check & possibly streamline this
// Unstable might be able to be OpMiddleware
// let unstable_checker = state.borrow::<super::UnstableChecker>();
// let unstable = unstable_checker.unstable;
state.put(Unstable(unstable));
Ok(())
})),
)
})
.build()
}
pub fn get_declaration() -> PathBuf {