From 2571d2f1f922bf0e1bf0f4d3637278d6e87bb904 Mon Sep 17 00:00:00 2001 From: Vincent Date: Thu, 15 Nov 2018 07:47:30 +0100 Subject: [PATCH] Adding polyfill for Safari WebAssembly --- web-client/src/app.ts | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/web-client/src/app.ts b/web-client/src/app.ts index 34eba62..e06d72a 100644 --- a/web-client/src/app.ts +++ b/web-client/src/app.ts @@ -13,6 +13,14 @@ Terminal.applyAddon(attach); Terminal.applyAddon(fullscreen); Terminal.applyAddon(fit); +// Polyfill for WebAssembly on Safari +if (!WebAssembly.instantiateStreaming) { + WebAssembly.instantiateStreaming = async (resp, importObject) => { + const source = await (await resp).arrayBuffer(); + return await WebAssembly.instantiate(source, importObject); + }; +} + const go = new Go(); WebAssembly.instantiateStreaming(fetch("main.wasm"), go.importObject).then( result => {