summaryrefslogtreecommitdiff
path: root/ext/broadcast_channel/lib.rs
diff options
context:
space:
mode:
authorBartek IwaƄczuk <biwanczuk@gmail.com>2023-10-04 21:42:17 +0200
committerGitHub <noreply@github.com>2023-10-04 21:42:17 +0200
commita5568066b3d979111134029f9e4f0c1b462b948e (patch)
tree14c4233cc01d55eda7f608b5194f6b088264b52e /ext/broadcast_channel/lib.rs
parent9a46a824bd897e240af8a14f9d950ab6d95f42a5 (diff)
refactor: use deno_core::FeatureChecker for unstable checks (#20765)
Diffstat (limited to 'ext/broadcast_channel/lib.rs')
-rw-r--r--ext/broadcast_channel/lib.rs16
1 files changed, 3 insertions, 13 deletions
diff --git a/ext/broadcast_channel/lib.rs b/ext/broadcast_channel/lib.rs
index 6ee10f9c0..49cc78415 100644
--- a/ext/broadcast_channel/lib.rs
+++ b/ext/broadcast_channel/lib.rs
@@ -40,8 +40,6 @@ pub trait BroadcastChannel: Clone {
pub type Message = (String, Vec<u8>);
-struct Unstable(bool); // --unstable
-
#[op2(fast)]
#[smi]
pub fn op_broadcast_subscribe<BC>(
@@ -50,15 +48,9 @@ pub fn op_broadcast_subscribe<BC>(
where
BC: BroadcastChannel + 'static,
{
- let unstable = state.borrow::<Unstable>().0;
-
- if !unstable {
- eprintln!(
- "Unstable API 'BroadcastChannel'. The --unstable flag must be provided.",
- );
- std::process::exit(70);
- }
-
+ state
+ .feature_checker
+ .check_legacy_unstable_or_exit("BroadcastChannel");
let bc = state.borrow::<BC>();
let resource = bc.subscribe()?;
Ok(state.resource_table.add(resource))
@@ -118,11 +110,9 @@ deno_core::extension!(deno_broadcast_channel,
esm = [ "01_broadcast_channel.js" ],
options = {
bc: BC,
- unstable: bool,
},
state = |state, options| {
state.put(options.bc);
- state.put(Unstable(options.unstable));
},
);