From 8fea92f0e5e2b75c8e04cfa1894707ccb6ac159b Mon Sep 17 00:00:00 2001 From: Daniel Kucal Date: Tue, 23 Jan 2018 12:13:04 +0100 Subject: [PATCH] fix(StorageEvent): don't change event prototype --- package-lock.json | 2 +- package.json | 2 +- src/utility/storage/storage-event.ts | 26 ++++++++++++-------------- 3 files changed, 14 insertions(+), 16 deletions(-) diff --git a/package-lock.json b/package-lock.json index d72d999..6a748b5 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "ngx-store", - "version": "1.4.0-RC1", + "version": "1.4.0-RC2", "lockfileVersion": 1, "requires": true, "dependencies": { diff --git a/package.json b/package.json index 710a01e..8276caf 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "ngx-store", "private": true, - "version": "1.4.0-RC1", + "version": "1.4.0-RC2", "description": "Angular decorators to automagically keep variables in HTML5 LocalStorage, SessionStorage, cookies; injectable services for managing and listening to data changes and a bit more.", "main": "./ngx-store.js", "main for angular5": "./bundles/ngx-store.umd.js", diff --git a/src/utility/storage/storage-event.ts b/src/utility/storage/storage-event.ts index 03f8cb8..1249e2e 100644 --- a/src/utility/storage/storage-event.ts +++ b/src/utility/storage/storage-event.ts @@ -18,47 +18,45 @@ export class NgxStorageEvent implements StorageEvent { public readonly url = window.location.href; public isInternal = true; - constructor(public type: string, public key: string, public storageArea: Storage) { - setTimeout(() => Object.setPrototypeOf(this, new StorageEvent(type))); - } + constructor(public type: string, public key: string, public storageArea: Storage) {} /** * Methods below exist only to satisfy TypeScript compiler */ public get scoped() { - return undefined; - }; + return StorageEvent.prototype.scoped; + } public get initEvent() { - return undefined; - }; + return StorageEvent.prototype.initEvent.bind(this); + } public get preventDefault() { - return undefined; + return StorageEvent.prototype.preventDefault.bind(this); } public get stopImmediatePropagation() { - return undefined; + return StorageEvent.prototype.stopImmediatePropagation.bind(this); } public get stopPropagation() { - return undefined; + return StorageEvent.prototype.stopPropagation.bind(this); } public get deepPath() { - return undefined; + return StorageEvent.prototype.deepPath.bind(this); } public get AT_TARGET() { - return undefined; + return StorageEvent.prototype.AT_TARGET; } public get BUBBLING_PHASE() { - return undefined; + return StorageEvent.prototype.BUBBLING_PHASE; } public get CAPTURING_PHASE() { - return undefined; + return StorageEvent.prototype.BUBBLING_PHASE; } }