@@ -37,10 +37,12 @@ const _override = /* @__PURE__ */ (function () {
3737 }
3838
3939 async wasm ( ) {
40- const _wasm = wasm ;
40+ const _wasm = await wasm ;
4141 if ( _wasm . buffer && _wasm . buffer instanceof ArrayBuffer ) {
4242 console . warn ( INLINE_WARNING ) ;
4343 this . _wasm = _wasm ;
44+ } else if ( _wasm instanceof ArrayBuffer ) {
45+ this . _wasm = _wasm ;
4446 } else {
4547 const req = await fetch ( _wasm ) ;
4648 this . _wasm = await req . arrayBuffer ( ) ;
@@ -156,22 +158,14 @@ const WORKER_SINGLETON = /* @__PURE__ */ (function () {
156158 } ;
157159} ) ( ) ;
158160
159- /**
160- * If Perspective is loaded with the `preload` attribute, pre-initialize the
161- * worker so it is available at page render.
162- */
163- if ( document . currentScript && document . currentScript . hasAttribute ( "preload" ) ) {
164- WORKER_SINGLETON . getInstance ( ) ;
165- }
166-
167161export const get_type_config = _get_type_config ;
168162
169163export function override ( x ) {
170164 return _override ( ) . set ( x ) ;
171165}
172166
173167/**
174- * Create a new WebWorkerClient instance. s
168+ * Create a new WebWorkerClient instance.
175169 * @param {* } [config] An optional perspective config object override
176170 */
177171export function worker ( config ) {
@@ -188,6 +182,11 @@ export function websocket(url = window.location.origin.replace("http", "ws")) {
188182 return new WebSocketClient ( new WebSocket ( url ) ) ;
189183}
190184
185+ /**
186+ * Return the shared worker, the original WebWorkerClient created during module
187+ * load.
188+ * @param {* } [config] An optional perspective config object override
189+ */
191190export function shared_worker ( config ) {
192191 return WORKER_SINGLETON . getInstance ( config ) ;
193192}
0 commit comments