0
0
Fork 0
mirror of https://github.com/denoland/deno.git synced 2024-10-31 09:14:20 -04:00
denoland-deno/op_crates/web/lib.rs
Luca Casonato e83ff62ccb
chore: split web op crate (#9635)
This commit starts splitting out the deno_web op crate into multiple
smaller crates. This commit splits out WebIDL and URL API, but in the
future I want to split out each spec into its own crate. That means we
will have (in rough order of loading): `webidl`, `dom`, `streams`,
`console`, `encoding`, `url`, `file`, `fetch`, `websocket`, and
`webgpu` crates.
2021-03-12 16:17:18 +01:00

45 lines
1.1 KiB
Rust

// Copyright 2018-2021 the Deno authors. All rights reserved. MIT license.
use deno_core::JsRuntime;
use std::path::PathBuf;
/// Load and execute the javascript code.
pub fn init(isolate: &mut JsRuntime) {
let files = vec![
(
"deno:op_crates/web/01_dom_exception.js",
include_str!("01_dom_exception.js"),
),
(
"deno:op_crates/web/02_event.js",
include_str!("02_event.js"),
),
(
"deno:op_crates/web/03_abort_signal.js",
include_str!("03_abort_signal.js"),
),
(
"deno:op_crates/web/04_global_interfaces.js",
include_str!("04_global_interfaces.js"),
),
(
"deno:op_crates/web/08_text_encoding.js",
include_str!("08_text_encoding.js"),
),
(
"deno:op_crates/web/12_location.js",
include_str!("12_location.js"),
),
(
"deno:op_crates/web/21_filereader.js",
include_str!("21_filereader.js"),
),
];
for (url, source_code) in files {
isolate.execute(url, source_code).unwrap();
}
}
pub fn get_declaration() -> PathBuf {
PathBuf::from(env!("CARGO_MANIFEST_DIR")).join("lib.deno_web.d.ts")
}