Skip to content

Commit 3c187c6

Browse files
committed
1 parent ed92603 commit 3c187c6

1 file changed

Lines changed: 7 additions & 6 deletions

File tree

src/lib/lz4/lz4-block-codec-wasm.js

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -123,16 +123,17 @@ context.LZ4BlockWASM.prototype = {
123123
flavor: 'wasm',
124124

125125
init: function() {
126-
if ( this.lz4wasmInstance instanceof WebAssembly.Instance ) {
127-
return Promise.resolve(this.lz4wasmInstance);
128-
}
129126
if (
130-
this.lz4wasmInstance === null ||
131-
WebAssembly instanceof Object === false ||
127+
typeof WebAssembly !== 'object' ||
132128
typeof WebAssembly.instantiateStreaming !== 'function'
133129
) {
134130
this.lz4wasmInstance = null;
135-
return Promise.resolve(null);
131+
}
132+
if ( this.lz4wasmInstance === null ) {
133+
return Promise.reject();
134+
}
135+
if ( this.lz4wasmInstance instanceof WebAssembly.Instance ) {
136+
return Promise.resolve(this.lz4wasmInstance);
136137
}
137138
if ( this.lz4wasmInstance === undefined ) {
138139
this.lz4wasmInstance = WebAssembly.instantiateStreaming(

0 commit comments

Comments
 (0)