Skip to content

getWasmBytes crashes in web worker #102

@andrewbranch

Description

@andrewbranch

getWasmBytes contains the lines:

if (typeof window !== 'undefined' && typeof atob === 'function')
  return Uint8Array.from(atob(binary), x => x.charCodeAt(0));
return Buffer.from(binary, 'base64');

In a web worker, window is undefined, but Buffer is not available either. The condition should be updated to pass inside web workers. I’m happy to open a PR, but I wasn’t sure what the best detection mechanism was. Maybe (typeof window !== 'undefined' || typeof self !== 'undefined') && typeof atob === 'function'?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions