From a5568066b3d979111134029f9e4f0c1b462b948e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bartek=20Iwa=C5=84czuk?= Date: Wed, 4 Oct 2023 21:42:17 +0200 Subject: refactor: use deno_core::FeatureChecker for unstable checks (#20765) --- ext/broadcast_channel/lib.rs | 16 +++------------- 1 file changed, 3 insertions(+), 13 deletions(-) (limited to 'ext/broadcast_channel') 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); -struct Unstable(bool); // --unstable - #[op2(fast)] #[smi] pub fn op_broadcast_subscribe( @@ -50,15 +48,9 @@ pub fn op_broadcast_subscribe( where BC: BroadcastChannel + 'static, { - let unstable = state.borrow::().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::(); 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)); }, ); -- cgit v1.2.3