Skip to content

Commit

Permalink
Use web_sys_unstable_apis when available
Browse files Browse the repository at this point in the history
  • Loading branch information
MattiasBuelens committed Oct 7, 2023
1 parent dc24b46 commit b86e3e8
Showing 1 changed file with 12 additions and 3 deletions.
15 changes: 12 additions & 3 deletions src/queuing_strategy/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,18 @@ extern "C" {

impl QueuingStrategy {
pub fn new(high_water_mark: f64) -> Self {
let strategy = Object::new().unchecked_into::<QueuingStrategy>();
strategy.set_high_water_mark(high_water_mark);
strategy
#[cfg(web_sys_unstable_apis)]
{
let mut strategy = web_sys::QueuingStrategy::new();
strategy.high_water_mark(high_water_mark);
return Self::from_raw(strategy);
}
#[cfg(not(web_sys_unstable_apis))]
{
let strategy = Object::new().unchecked_into::<QueuingStrategy>();
strategy.set_high_water_mark(high_water_mark);
return strategy;

Check warning on line 29 in src/queuing_strategy/mod.rs

View workflow job for this annotation

GitHub Actions / Lint

unneeded `return` statement

Check warning on line 29 in src/queuing_strategy/mod.rs

View workflow job for this annotation

GitHub Actions / Lint

unneeded `return` statement
}
}

#[cfg(web_sys_unstable_apis)]
Expand Down

0 comments on commit b86e3e8

Please sign in to comment.