Skip to content

Commit

Permalink
Add QueuingStrategy::from_raw
Browse files Browse the repository at this point in the history
  • Loading branch information
MattiasBuelens committed Oct 7, 2023
1 parent f0c2b5e commit 00309ae
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/queuing_strategy/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,15 @@ impl QueuingStrategy {
Self { high_water_mark }
}

#[cfg(web_sys_unstable_apis)]
pub fn from_raw(raw: web_sys::QueuingStrategy) -> Self {
let high_water_mark = js_sys::Reflect::get(&raw, &JsValue::from_str("highWaterMark"))
.unwrap_throw()
.as_f64()
.unwrap_throw();
Self::new(high_water_mark)
}

#[cfg(web_sys_unstable_apis)]
pub fn into_raw(self) -> web_sys::QueuingStrategy {
let mut raw = web_sys::QueuingStrategy::new();
Expand Down

0 comments on commit 00309ae

Please sign in to comment.