Skip to content

Commit

Permalink
Implemented UnderlyingSource
Browse files Browse the repository at this point in the history
  • Loading branch information
xavierm02 committed Dec 4, 2023
1 parent 6307cb4 commit 65c10c3
Show file tree
Hide file tree
Showing 4 changed files with 427 additions and 0 deletions.
1 change: 1 addition & 0 deletions jstz_api/src/stream/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ use boa_engine::Context;
use self::readable::ReadableStreamApi;

pub mod readable;
mod tmp;

pub struct StreamApi;

Expand Down
9 changes: 9 additions & 0 deletions jstz_api/src/stream/readable/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,12 @@ use jstz_core::native::{
register_global_class, ClassBuilder, JsNativeObject, NativeClass,
};

use crate::stream::readable::underlying_source::{
UnderlyingSource, UnderlyingSourceTrait,
};

pub mod underlying_source;

pub struct ReadableStream {
// TODO
}
Expand All @@ -30,6 +36,9 @@ impl NativeClass for ReadableStreamClass {
args: &[boa_engine::JsValue],
context: &mut Context<'_>,
) -> JsResult<Self::Instance> {
let underlying_source =
Option::<UnderlyingSource>::try_from_js(args.get_or_undefined(0), context)?;
underlying_source.cancel(Some(boa_engine::js_string!("reason").into()), context);
todo!()
}

Expand Down
Loading

0 comments on commit 65c10c3

Please sign in to comment.