tejacques / crosstab

A utility library for cross-tab communication using localStorage.
Apache License 2.0
365 stars 58 forks source link

"crosstab not supported" when using with Browserify #37

Closed rikukissa closed 9 years ago

rikukissa commented 9 years ago

Uncaught Error: crosstab not supported: localStorage not availabe, addEventListener not available, localStorage.setItem not allowed

The context variable this passed to the factory function refers to module.export instead of window object in Browserify environment.

https://github.com/tejacques/crosstab/commit/2bf8403b77b2612680fa44e4014d5b2ff1d41938 seems to cause this so the problem exists only in 0.2.8

tejacques commented 9 years ago

Yeah that's definitely a problem.

I think it can be fixed by replacing this with:

(function() { try { return window; } catch(e) { return global; } })()

I will make this change today and push it to npm

tejacques commented 9 years ago

Commit with fix is in -- will push to npm shortly as 0.2.9