Skip to content

Amplitude support in web workers? #240

@troygibb

Description

@troygibb

If you write the following in a webpack bundled app:

import amplitude from from 'amplitude-js';

And this statement occurs within a web-worker context, you get Uncaught ReferenceError: window is not defined from this block:

} else if (window.globalStorage) {
      // Firefox 2-3 use globalStorage
      // See https://developer.mozilla.org/en/dom/storage#globalStorage
      try {
        localStorage = window.globalStorage[window.location.hostname];
      } catch (e) {// Something bad happened...
      }
    } 

Is there any plan to support amplitude within a web worker?

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions