diff options
Diffstat (limited to 'ext/websocket')
-rw-r--r-- | ext/websocket/00_ops.js | 35 | ||||
-rw-r--r-- | ext/websocket/01_websocket.js | 18 | ||||
-rw-r--r-- | ext/websocket/02_websocketstream.js | 18 | ||||
-rw-r--r-- | ext/websocket/lib.rs | 2 |
4 files changed, 54 insertions, 19 deletions
diff --git a/ext/websocket/00_ops.js b/ext/websocket/00_ops.js new file mode 100644 index 000000000..38628f8c3 --- /dev/null +++ b/ext/websocket/00_ops.js @@ -0,0 +1,35 @@ +// Copyright 2018-2023 the Deno authors. All rights reserved. MIT license. +import { core } from "ext:core/mod.js"; +const { + op_ws_create, + op_ws_close, + op_ws_send_binary, + op_ws_send_binary_ab, + op_ws_send_text, + op_ws_next_event, + op_ws_get_buffer, + op_ws_get_buffer_as_string, + op_ws_get_error, + op_ws_send_ping, + op_ws_get_buffered_amount, + op_ws_send_text_async, + op_ws_send_binary_async, + op_ws_check_permission_and_cancel_handle, +} = core.ensureFastOps(); + +export { + op_ws_check_permission_and_cancel_handle, + op_ws_close, + op_ws_create, + op_ws_get_buffer, + op_ws_get_buffer_as_string, + op_ws_get_buffered_amount, + op_ws_get_error, + op_ws_next_event, + op_ws_send_binary, + op_ws_send_binary_ab, + op_ws_send_binary_async, + op_ws_send_ping, + op_ws_send_text, + op_ws_send_text_async, +}; diff --git a/ext/websocket/01_websocket.js b/ext/websocket/01_websocket.js index 2aea08071..e2ff26c6c 100644 --- a/ext/websocket/01_websocket.js +++ b/ext/websocket/01_websocket.js @@ -44,20 +44,20 @@ const { SymbolFor, TypedArrayPrototypeGetByteLength, } = primordials; -const { op_ws_check_permission_and_cancel_handle } = core.ops; -const { - op_ws_create, +import { + op_ws_check_permission_and_cancel_handle, op_ws_close, - op_ws_send_binary, - op_ws_send_binary_ab, - op_ws_send_text, - op_ws_next_event, + op_ws_create, op_ws_get_buffer, op_ws_get_buffer_as_string, + op_ws_get_buffered_amount, op_ws_get_error, + op_ws_next_event, + op_ws_send_binary, + op_ws_send_binary_ab, op_ws_send_ping, - op_ws_get_buffered_amount, -} = core.ensureFastOps(); + op_ws_send_text, +} from "ext:deno_websocket/00_ops.js"; webidl.converters["sequence<DOMString> or DOMString"] = ( V, diff --git a/ext/websocket/02_websocketstream.js b/ext/websocket/02_websocketstream.js index 16346e73b..62124bd45 100644 --- a/ext/websocket/02_websocketstream.js +++ b/ext/websocket/02_websocketstream.js @@ -3,7 +3,6 @@ /// <reference path="../../core/internal.d.ts" /> import { core, primordials } from "ext:core/mod.js"; -const ops = core.ops; import * as webidl from "ext:deno_webidl/00_webidl.js"; import { createFilteredInspectProxy } from "ext:deno_console/01_console.js"; import { Deferred, writableStreamClose } from "ext:deno_web/06_streams.js"; @@ -32,16 +31,17 @@ const { TypedArrayPrototypeGetByteLength, Uint8ArrayPrototype, } = primordials; -const { - op_ws_send_text_async, - op_ws_send_binary_async, - op_ws_next_event, +import { + op_ws_check_permission_and_cancel_handle, + op_ws_close, + op_ws_create, op_ws_get_buffer, op_ws_get_buffer_as_string, op_ws_get_error, - op_ws_create, - op_ws_close, -} = core.ensureFastOps(); + op_ws_next_event, + op_ws_send_binary_async, + op_ws_send_text_async, +} from "ext:deno_websocket/00_ops.js"; webidl.converters.WebSocketStreamOptions = webidl.createDictionaryConverter( "WebSocketStreamOptions", @@ -146,7 +146,7 @@ class WebSocketStream { fillHeaders(headers, options.headers); } - const cancelRid = ops.op_ws_check_permission_and_cancel_handle( + const cancelRid = op_ws_check_permission_and_cancel_handle( "WebSocketStream.abort()", this[_url], true, diff --git a/ext/websocket/lib.rs b/ext/websocket/lib.rs index c8e0921c9..d25f7ecbd 100644 --- a/ext/websocket/lib.rs +++ b/ext/websocket/lib.rs @@ -843,7 +843,7 @@ deno_core::extension!(deno_websocket, op_ws_send_pong, op_ws_get_buffered_amount, ], - esm = [ "01_websocket.js", "02_websocketstream.js" ], + esm = [ "00_ops.js", "01_websocket.js", "02_websocketstream.js" ], options = { user_agent: String, root_cert_store_provider: Option<Arc<dyn RootCertStoreProvider>>, |