reactive-localstorage
Advanced tools
Comparing version 0.1.0-alpha.1 to 0.1.0-alpha.2
@@ -9,3 +9,2 @@ export declare class LocalStorage implements Storage { | ||
protected _length: number; | ||
protected _injected: boolean; | ||
constructor(window?: Window, storage?: Storage); | ||
@@ -23,3 +22,3 @@ readonly length: number; | ||
protected emit<K extends keyof ReactiveLocalStorageEventMap>(name: K, ...args: ReactiveLocalStorageEventMap[K] extends (...args: infer T) => any ? T : any[]): void; | ||
protected inject(target: Window, storage: Storage): void; | ||
protected inject(storage: Storage): void; | ||
} | ||
@@ -26,0 +25,0 @@ export interface ReactiveLocalStorageEventMap { |
@@ -0,1 +1,4 @@ | ||
const $injectMark = Symbol.for('reactive-localstorage-inject-mark'); | ||
const $handlers = Symbol.for('reactive-localstorage-handlers'); | ||
const { getItem, setItem, removeItem } = Storage.prototype; | ||
export class LocalStorage { | ||
@@ -5,3 +8,2 @@ constructor(window, storage) { | ||
this._length = 0; | ||
this._injected = false; | ||
if (window) { | ||
@@ -16,3 +18,3 @@ this.supported = true; | ||
this._cache = new Map(); | ||
this.inject(window, this.native); | ||
this.inject(this.native); | ||
listen(window, ({ key, newValue, oldValue }) => { | ||
@@ -34,3 +36,3 @@ if (!key) | ||
return cache.get(key); | ||
const value = this.native.getItem(key); | ||
const value = call(getItem, this.native, key); | ||
cache.set(key, value); | ||
@@ -73,6 +75,6 @@ return value; | ||
if (typeof value === 'string') { | ||
this.native.setItem(key, value); | ||
call(setItem, this.native, key, value); | ||
} | ||
else { | ||
this.native.removeItem(key); | ||
call(removeItem, this.native, key); | ||
} | ||
@@ -90,40 +92,19 @@ cache.set(key, value); | ||
} | ||
inject(target, storage) { | ||
inject(storage) { | ||
const me = this; | ||
const cache = this._cache; | ||
const injected = Object.create(storage); | ||
Object.defineProperties(injected, { | ||
getItem: { | ||
configurable: true, | ||
enumerable: false, | ||
writable: true, | ||
value(key) { | ||
const value = storage.getItem(key); | ||
cache.set(key, value); | ||
}, | ||
storage[$handlers] = { | ||
getItem(key) { | ||
const value = getItem.call(this, key); | ||
cache.set(key, value); | ||
}, | ||
setItem: { | ||
configurable: true, | ||
enumerable: false, | ||
writable: true, | ||
value(key, value) { | ||
set(key, String(value)); | ||
}, | ||
setItem(key, value) { | ||
call(set, this, key, String(value)); | ||
}, | ||
removeItem: { | ||
configurable: true, | ||
enumerable: false, | ||
writable: true, | ||
value(key) { | ||
set(key, null); | ||
}, | ||
} | ||
}); | ||
Object.defineProperty(target, 'localStorage', { | ||
...Object.getOwnPropertyDescriptor(window, 'localStorage'), | ||
get: () => injected, | ||
}); | ||
this._injected = true; | ||
removeItem(key) { | ||
call(set, this, key, null); | ||
}, | ||
}; | ||
function set(key, newValue) { | ||
let oldValue; | ||
let oldValue = null; | ||
let error; | ||
@@ -139,6 +120,6 @@ let hasError = false; | ||
if (newValue === null) { | ||
storage.removeItem(key); | ||
removeItem.call(this, key); | ||
} | ||
else { | ||
storage.setItem(key, newValue); | ||
setItem.call(this, key, newValue); | ||
} | ||
@@ -152,3 +133,5 @@ if (hasError) { | ||
cache.set(key, newValue); | ||
me.feed(key, newValue, oldValue); | ||
if (newValue !== oldValue) { | ||
me.feed(key, newValue, oldValue); | ||
} | ||
} | ||
@@ -174,2 +157,50 @@ catch (e) { | ||
} | ||
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoibG9jYWxzdG9yYWdlLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vc3JjL2xvY2Fsc3RvcmFnZS50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQSxNQUFNLE9BQU8sWUFBWTtJQVd2QixZQUFZLE1BQWUsRUFBRSxPQUFpQjtRQVBwQyxZQUFPLEdBRWIsRUFBRSxDQUFBO1FBRUksWUFBTyxHQUFHLENBQUMsQ0FBQTtRQUNYLGNBQVMsR0FBRyxLQUFLLENBQUE7UUFHekIsSUFBSSxNQUFNLEVBQUU7WUFDVixJQUFJLENBQUMsU0F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...args) { | ||
return fn.apply(me, args); | ||
} | ||
inject(); | ||
function inject() { | ||
if (Storage.prototype[$injectMark]) { | ||
console.warn(`Storage has been injected, there might be multi versions of reactive-localstorage`); | ||
return; | ||
} | ||
Object.defineProperties(Storage.prototype, { | ||
getItem: { | ||
configurable: true, | ||
enumerable: false, | ||
writable: true, | ||
value(key) { | ||
const handlers = this[$handlers]; | ||
if (handlers && typeof handlers.getItem === 'function') { | ||
return handlers.getItem.call(this, key); | ||
} | ||
return getItem.call(this, key); | ||
}, | ||
}, | ||
setItem: { | ||
configurable: true, | ||
enumerable: false, | ||
writable: true, | ||
value(key, value) { | ||
const handlers = this[$handlers]; | ||
if (handlers && typeof handlers.setItem === 'function') { | ||
return handlers.setItem.call(this, key, value); | ||
} | ||
return setItem.call(this, key, value); | ||
}, | ||
}, | ||
removeItem: { | ||
configurable: true, | ||
enumerable: false, | ||
writable: true, | ||
value(key) { | ||
const handlers = this[$handlers]; | ||
if (handlers && typeof handlers.setItem === 'function') { | ||
return handlers.removeItem.call(this, key); | ||
} | ||
return removeItem.call(this, key); | ||
}, | ||
} | ||
}); | ||
} | ||
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoibG9jYWxzdG9yYWdlLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vc3JjL2xvY2Fsc3RvcmFnZS50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQSxNQUFNLFdBQVcsR0FBRyxNQUFNLENBQUMsR0FBRyxDQUFDLG1DQUFtQyxDQUFDLENBQUE7QUFDbkUsTUFBTSxTQUFTLEdBQUcsTUFBTSxDQUFDLEdBQUcsQ0FBQyxnQ0FBZ0MsQ0FBQyxDQUFBO0FBRTlELE1BQU0sRUFBRSxPQUFPLEVBQUUsT0FBTyxFQUFFLFVBQVUsRUFBRSxHQUFHLE9BQU8sQ0FBQyxTQUFTLENBQUE7QUFFMUQsTUFBTSxPQUFPLFlBQV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FQUFFLElBQUk7WUFDZCxLQUFLLENBQWdCLEdBQVc7Z0JBQzlCLE1BQU0sUUFBUSxHQUFHLElBQUksQ0FBQyxTQUFTLENBQUMsQ0FBQTtnQkFDaEMsSUFBSSxRQUFRLElBQUksT0FBTyxRQUFRLENBQUMsT0FBTyxLQUFLLFVBQVUsRUFBRTtvQkFDdEQsT0FBTyxRQUFRLENBQUMsVUFBVSxDQUFDLElBQUksQ0FBQyxJQUFJLEVBQUUsR0FBRyxDQUFDLENBQUE7aUJBQzNDO2dCQUNELE9BQU8sVUFBVSxDQUFDLElBQUksQ0FBQyxJQUFJLEVBQUUsR0FBRyxDQUFDLENBQUE7WUFDbkMsQ0FBQztTQUNGO0tBQ0YsQ0FBQyxDQUFBO0FBQ0osQ0FBQyJ9 |
@@ -9,3 +9,2 @@ export declare class LocalStorage implements Storage { | ||
protected _length: number; | ||
protected _injected: boolean; | ||
constructor(window?: Window, storage?: Storage); | ||
@@ -23,3 +22,3 @@ readonly length: number; | ||
protected emit<K extends keyof ReactiveLocalStorageEventMap>(name: K, ...args: ReactiveLocalStorageEventMap[K] extends (...args: infer T) => any ? T : any[]): void; | ||
protected inject(target: Window, storage: Storage): void; | ||
protected inject(storage: Storage): void; | ||
} | ||
@@ -26,0 +25,0 @@ export interface ReactiveLocalStorageEventMap { |
"use strict"; | ||
var __assign = (this && this.__assign) || function () { | ||
__assign = Object.assign || function(t) { | ||
for (var s, i = 1, n = arguments.length; i < n; i++) { | ||
s = arguments[i]; | ||
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) | ||
t[p] = s[p]; | ||
} | ||
return t; | ||
}; | ||
return __assign.apply(this, arguments); | ||
}; | ||
var __values = (this && this.__values) || function (o) { | ||
@@ -24,2 +13,5 @@ var m = typeof Symbol === "function" && o[Symbol.iterator], i = 0; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
var $injectMark = Symbol.for('reactive-localstorage-inject-mark'); | ||
var $handlers = Symbol.for('reactive-localstorage-handlers'); | ||
var _a = Storage.prototype, getItem = _a.getItem, setItem = _a.setItem, removeItem = _a.removeItem; | ||
var LocalStorage = /** @class */ (function () { | ||
@@ -30,3 +22,2 @@ function LocalStorage(window, storage) { | ||
this._length = 0; | ||
this._injected = false; | ||
if (window) { | ||
@@ -41,3 +32,3 @@ this.supported = true; | ||
this._cache = new Map(); | ||
this.inject(window, this.native); | ||
this.inject(this.native); | ||
listen(window, function (_a) { | ||
@@ -64,3 +55,3 @@ var key = _a.key, newValue = _a.newValue, oldValue = _a.oldValue; | ||
return cache.get(key); | ||
var value = this.native.getItem(key); | ||
var value = call(getItem, this.native, key); | ||
cache.set(key, value); | ||
@@ -114,6 +105,6 @@ return value; | ||
if (typeof value === 'string') { | ||
this.native.setItem(key, value); | ||
call(setItem, this.native, key, value); | ||
} | ||
else { | ||
this.native.removeItem(key); | ||
call(removeItem, this.native, key); | ||
} | ||
@@ -146,37 +137,19 @@ cache.set(key, value); | ||
}; | ||
LocalStorage.prototype.inject = function (target, storage) { | ||
LocalStorage.prototype.inject = function (storage) { | ||
var me = this; | ||
var cache = this._cache; | ||
var injected = Object.create(storage); | ||
Object.defineProperties(injected, { | ||
getItem: { | ||
configurable: true, | ||
enumerable: false, | ||
writable: true, | ||
value: function (key) { | ||
var value = storage.getItem(key); | ||
cache.set(key, value); | ||
}, | ||
storage[$handlers] = { | ||
getItem: function (key) { | ||
var value = getItem.call(this, key); | ||
cache.set(key, value); | ||
}, | ||
setItem: { | ||
configurable: true, | ||
enumerable: false, | ||
writable: true, | ||
value: function (key, value) { | ||
set(key, String(value)); | ||
}, | ||
setItem: function (key, value) { | ||
call(set, this, key, String(value)); | ||
}, | ||
removeItem: { | ||
configurable: true, | ||
enumerable: false, | ||
writable: true, | ||
value: function (key) { | ||
set(key, null); | ||
}, | ||
} | ||
}); | ||
Object.defineProperty(target, 'localStorage', __assign({}, Object.getOwnPropertyDescriptor(window, 'localStorage'), { get: function () { return injected; } })); | ||
this._injected = true; | ||
removeItem: function (key) { | ||
call(set, this, key, null); | ||
}, | ||
}; | ||
function set(key, newValue) { | ||
var oldValue; | ||
var oldValue = null; | ||
var error; | ||
@@ -192,6 +165,6 @@ var hasError = false; | ||
if (newValue === null) { | ||
storage.removeItem(key); | ||
removeItem.call(this, key); | ||
} | ||
else { | ||
storage.setItem(key, newValue); | ||
setItem.call(this, key, newValue); | ||
} | ||
@@ -205,3 +178,5 @@ if (hasError) { | ||
cache.set(key, newValue); | ||
me.feed(key, newValue, oldValue); | ||
if (newValue !== oldValue) { | ||
me.feed(key, newValue, oldValue); | ||
} | ||
} | ||
@@ -230,2 +205,54 @@ catch (e) { | ||
exports.listen = listen; | ||
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoibG9jYWxzdG9yYWdlLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vc3JjL2xvY2Fsc3RvcmFnZS50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOzs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7OztBQUFBO0lBV0Usc0JBQVksTUFBZSxFQUFFLE9BQWlCO1FBQTlDLGlCQWNDO1FBckJTLFlBQU8sR0FFYixFQUFFLENBQUE7UUFFSSxZQUFPLEdBQUcsQ0FBQyxDQUFBO1FBQ1gsY0FBUyxHQUFHLEtBQUssQ0FBQTtRQUd6QixJQUFJLE1BQU0sRUFBRTtZQUNWLElBQUksQ0FBQyxTQUFTLEdBQUcsSUFBSSxDQUFBO1NBQ3RCO2FBQU07WUFDTCxJQUFJLENBQUMsU0FBUyxHQUFHLEtBQUssQ0FBQTtZQUN0QixNQUFNLEdBQUcsSUFBSSxNQUFNLEVBQUUsQ0FBQTtTQUN0QjtRQUNELElBQUksQ0FBQyxNQUFNLEdBQUcsT0FBTyxJQUFJLE1BQU0sQ0FBQyxZQUFZLENBQUE7UUFDNUMsSUFBSSxDQUFDLE1BQU0sR0FBRyxJQUFJLEdBQUcsRUFBRSxDQUFB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0QsT0FBTyxJQUFJLENBQUE7QUFDYixDQUFDO0FBVEQsd0JBU0MifQ== | ||
function call(fn, me) { | ||
var args = []; | ||
for (var _i = 2; _i < arguments.length; _i++) { | ||
args[_i - 2] = arguments[_i]; | ||
} | ||
return fn.apply(me, args); | ||
} | ||
inject(); | ||
function inject() { | ||
if (Storage.prototype[$injectMark]) { | ||
console.warn("Storage has been injected, there might be multi versions of reactive-localstorage"); | ||
return; | ||
} | ||
Object.defineProperties(Storage.prototype, { | ||
getItem: { | ||
configurable: true, | ||
enumerable: false, | ||
writable: true, | ||
value: function (key) { | ||
var handlers = this[$handlers]; | ||
if (handlers && typeof handlers.getItem === 'function') { | ||
return handlers.getItem.call(this, key); | ||
} | ||
return getItem.call(this, key); | ||
}, | ||
}, | ||
setItem: { | ||
configurable: true, | ||
enumerable: false, | ||
writable: true, | ||
value: function (key, value) { | ||
var handlers = this[$handlers]; | ||
if (handlers && typeof handlers.setItem === 'function') { | ||
return handlers.setItem.call(this, key, value); | ||
} | ||
return setItem.call(this, key, value); | ||
}, | ||
}, | ||
removeItem: { | ||
configurable: true, | ||
enumerable: false, | ||
writable: true, | ||
value: function (key) { | ||
var handlers = this[$handlers]; | ||
if (handlers && typeof handlers.setItem === 'function') { | ||
return handlers.removeItem.call(this, key); | ||
} | ||
return removeItem.call(this, key); | ||
}, | ||
} | ||
}); | ||
} | ||
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoibG9jYWxzdG9yYWdlLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vc3JjL2xvY2Fsc3RvcmFnZS50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOzs7Ozs7Ozs7Ozs7QUFBQSxJQUFNLFdBQVcsR0FBRyxNQUFNLENBQUMsR0FBRyxDQUFDLG1DQUFtQyxDQUFDLENBQUE7QUFDbkUsSUFBTSxTQUFTLEdBQUcsTUFBTSxDQUFDLEdBQUcsQ0FBQy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DbEIsVUFBVSxFQUFFLEtBQUs7WUFDakIsUUFBUSxFQUFFLElBQUk7WUFDZCxLQUFLLFlBQWdCLEdBQVcsRUFBRSxLQUFVO2dCQUMxQyxJQUFNLFFBQVEsR0FBRyxJQUFJLENBQUMsU0FBUyxDQUFDLENBQUE7Z0JBQ2hDLElBQUksUUFBUSxJQUFJLE9BQU8sUUFBUSxDQUFDLE9BQU8sS0FBSyxVQUFVLEVBQUU7b0JBQ3RELE9BQU8sUUFBUSxDQUFDLE9BQU8sQ0FBQyxJQUFJLENBQUMsSUFBSSxFQUFFLEdBQUcsRUFBRSxLQUFLLENBQUMsQ0FBQTtpQkFDL0M7Z0JBQ0QsT0FBTyxPQUFPLENBQUMsSUFBSSxDQUFDLElBQUksRUFBRSxHQUFHLEVBQUUsS0FBSyxDQUFDLENBQUE7WUFDdkMsQ0FBQztTQUNGO1FBQ0QsVUFBVSxFQUFFO1lBQ1YsWUFBWSxFQUFFLElBQUk7WUFDbEIsVUFBVSxFQUFFLEtBQUs7WUFDakIsUUFBUSxFQUFFLElBQUk7WUFDZCxLQUFLLFlBQWdCLEdBQVc7Z0JBQzlCLElBQU0sUUFBUSxHQUFHLElBQUksQ0FBQyxTQUFTLENBQUMsQ0FBQTtnQkFDaEMsSUFBSSxRQUFRLElBQUksT0FBTyxRQUFRLENBQUMsT0FBTyxLQUFLLFVBQVUsRUFBRTtvQkFDdEQsT0FBTyxRQUFRLENBQUMsVUFBVSxDQUFDLElBQUksQ0FBQyxJQUFJLEVBQUUsR0FBRyxDQUFDLENBQUE7aUJBQzNDO2dCQUNELE9BQU8sVUFBVSxDQUFDLElBQUksQ0FBQyxJQUFJLEVBQUUsR0FBRyxDQUFDLENBQUE7WUFDbkMsQ0FBQztTQUNGO0tBQ0YsQ0FBQyxDQUFBO0FBQ0osQ0FBQyJ9 |
{ | ||
"name": "reactive-localstorage", | ||
"version": "0.1.0-alpha.1", | ||
"version": "0.1.0-alpha.2", | ||
"description": "A reactive localStorage with no dependency", | ||
@@ -8,2 +8,3 @@ "main": "lib/index.js", | ||
"scripts": { | ||
"start": "webpack-serve --open --config dev/webpack.config.js", | ||
"build": "rm -rf lib && tsc --pretty -p src/tsconfig.json && rm -rf es && tsc --pretty -p src/tsconfig.es.json" | ||
@@ -30,9 +31,16 @@ }, | ||
"devDependencies": { | ||
"@types/chai": "^4.1.4", | ||
"@types/mocha": "^5.2.4", | ||
"@types/node": "^10.3.1", | ||
"chai": "^4.1.2", | ||
"happypack": "^5.0.0", | ||
"html-webpack-plugin": "^3.2.0", | ||
"mocha": "^3.2.0", | ||
"ts-loader": "^4.5.0", | ||
"tslint": "^5.10.0", | ||
"tslint-eslint-rules": "^5.3.1", | ||
"typescript": "3.0.1" | ||
"typescript": "3.0.1", | ||
"webpack": "^4.17.1", | ||
"webpack-serve": "^2.0.2" | ||
} | ||
} |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
39100
523
0
13