Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
gorhill committed Aug 29, 2018
1 parent ed92603 commit 3c187c6
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions src/lib/lz4/lz4-block-codec-wasm.js
Original file line number Diff line number Diff line change
Expand Up @@ -123,16 +123,17 @@ context.LZ4BlockWASM.prototype = {
flavor: 'wasm',

init: function() {
if ( this.lz4wasmInstance instanceof WebAssembly.Instance ) {
return Promise.resolve(this.lz4wasmInstance);
}
if (
this.lz4wasmInstance === null ||
WebAssembly instanceof Object === false ||
typeof WebAssembly !== 'object' ||
typeof WebAssembly.instantiateStreaming !== 'function'
) {
this.lz4wasmInstance = null;
return Promise.resolve(null);
}
if ( this.lz4wasmInstance === null ) {
return Promise.reject();
}
if ( this.lz4wasmInstance instanceof WebAssembly.Instance ) {
return Promise.resolve(this.lz4wasmInstance);
}
if ( this.lz4wasmInstance === undefined ) {
this.lz4wasmInstance = WebAssembly.instantiateStreaming(
Expand Down

0 comments on commit 3c187c6

Please sign in to comment.