2.0.3 • Published 1 year ago

@krakenjs/cross-domain-safe-weakmap v2.0.3

Weekly downloads
-
License
Apache-2.0
Repository
github
Last release
1 year ago

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.