Skip to content

Commit

Permalink
throw when initialize gets wasmModule (#2323)
Browse files Browse the repository at this point in the history
  • Loading branch information
evanw committed Jun 16, 2022
1 parent d500061 commit 4ee0aad
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 0 deletions.
1 change: 1 addition & 0 deletions lib/deno/mod.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ let initializeWasCalled = false
export const initialize: typeof types.initialize = async (options) => {
options = common.validateInitializeOptions(options || {})
if (options.wasmURL) throw new Error(`The "wasmURL" option only works in the browser`)
if (options.wasmModule) throw new Error(`The "wasmModule" option only works in the browser`)
if (options.worker) throw new Error(`The "worker" option only works in the browser`)
if (initializeWasCalled) throw new Error('Cannot call "initialize" more than once')
await ensureServiceIsRunning()
Expand Down
1 change: 1 addition & 0 deletions lib/npm/node.ts
Original file line number Diff line number Diff line change
Expand Up @@ -226,6 +226,7 @@ let initializeWasCalled = false;
export let initialize: typeof types.initialize = options => {
options = common.validateInitializeOptions(options || {});
if (options.wasmURL) throw new Error(`The "wasmURL" option only works in the browser`)
if (options.wasmModule) throw new Error(`The "wasmModule" option only works in the browser`)
if (options.worker) throw new Error(`The "worker" option only works in the browser`)
if (initializeWasCalled) throw new Error('Cannot call "initialize" more than once')
ensureServiceIsRunning()
Expand Down

0 comments on commit 4ee0aad

Please sign in to comment.