krakenjs / cross-domain-safe-weakmap

Cross-domain safe WeakMap shim

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Cross Domain Safe WeakMap

build status code coverage npm version apache license

WeakMap shim that works with cross-domain windows. Uses native WeakMap when available.

Installation

As of version 2 this package will be published under the @krakenjs scope.

npm install @krakenjs/cross-domain-safe-weakmap

Rationale

Storing references to window objects is memory-expensive, even after those window objects have closed.

Existing WeakMap shims hang an object of the WeakMap key. This poses a problem when dealing with cross-domain windows, where setting or getting any key other than a pre-defined set of readonly values, will throw a cross-origin error.

About

Cross-domain safe WeakMap shim

License:Apache License 2.0


Languages

Language:JavaScript 99.1%Language:Shell 0.9%