Comparing version
@@ -5,2 +5,7 @@ # Change Log | ||
<a name="3.0.9"></a> | ||
## [3.0.9](https://github.com/zerkalica/lom_atom/compare/v3.0.8...v3.0.9) (2017-12-02) | ||
<a name="3.0.8"></a> | ||
@@ -7,0 +12,0 @@ ## [3.0.8](https://github.com/zerkalica/lom_atom/compare/v3.0.7...v3.0.8) (2017-11-30) |
@@ -63,2 +63,7 @@ function _defineProperties(target, props) { | ||
} | ||
var scheduleNative = typeof requestAnimationFrame === 'function' ? function (handler) { | ||
return requestAnimationFrame(handler); | ||
} : function (handler) { | ||
return setTimeout(handler, 16); | ||
}; | ||
@@ -287,3 +292,3 @@ var handlers = new Map([[Array, function arrayHandler(target, source, stack) { | ||
var prev = this.current; | ||
var next = nextRaw instanceof Error ? new Proxy(nextRaw, throwOnAccess) : conform(nextRaw, prev, this.isComponent); | ||
var next = nextRaw instanceof Error ? nextRaw[origId] ? nextRaw : new Proxy(nextRaw, throwOnAccess) : conform(nextRaw, prev, this.isComponent); | ||
@@ -368,5 +373,4 @@ if (prev !== next) { | ||
this._masters = new Set(); | ||
} // if (master.manualReset) this.manualReset = true | ||
} | ||
this._masters.add(master); | ||
@@ -384,8 +388,2 @@ }; | ||
var scheduleNative = typeof requestAnimationFrame === 'function' ? function (handler) { | ||
return requestAnimationFrame(handler); | ||
} : function (handler) { | ||
return setTimeout(handler, 16); | ||
}; | ||
function reap(atom, key, reaping) { | ||
@@ -668,7 +666,7 @@ reaping.delete(atom); | ||
if (definingProperty) { | ||
return this[hk]; | ||
return this[hk].bind(this); | ||
} | ||
var actionFn = createActionMethod(this, hk, context); | ||
definingProperty = true; | ||
var actionFn = createActionMethod(this, hk, context); | ||
Object.defineProperty(this, name, { | ||
@@ -849,2 +847,3 @@ configurable: true, | ||
memkey.manual = memkeyManual; | ||
function cache(data) { | ||
@@ -867,9 +866,44 @@ isForceCache = false; | ||
value: memkey | ||
}, | ||
Wait: { | ||
value: AtomWait // toAtom: {value: toAtom } | ||
} | ||
}); | ||
function defer(proto, name, descr) { | ||
var origFn = descr.value; | ||
if (!origFn) throw new Error('Not a method'); | ||
var definingProperty = false; | ||
function value() { | ||
var _this = this; | ||
if (definingProperty) { | ||
return origFn.bind(this); | ||
} | ||
var fn = function fn() { | ||
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) { | ||
args[_key] = arguments[_key]; | ||
} | ||
scheduleNative(function () { | ||
return origFn.apply(_this, args); | ||
}); | ||
}; | ||
fn.displayName = name + "#defer"; | ||
definingProperty = true; | ||
Object.defineProperty(this, name, { | ||
configurable: true, | ||
value: fn | ||
}); | ||
definingProperty = false; | ||
return fn; | ||
} | ||
return { | ||
enumerable: descr.enumerable, | ||
configurable: descr.configurable, | ||
get: value | ||
}; | ||
} | ||
function stringToColor(str) { | ||
@@ -926,3 +960,3 @@ var hash = 0; | ||
export { Atom, action, detached, mem, ConsoleLogger, defaultContext }; | ||
export { Atom, action, detached, mem, defer, ConsoleLogger, defaultContext, AtomWait }; | ||
//# sourceMappingURL=lom_atom.es.js.map |
@@ -67,2 +67,7 @@ 'use strict'; | ||
} | ||
var scheduleNative = typeof requestAnimationFrame === 'function' ? function (handler) { | ||
return requestAnimationFrame(handler); | ||
} : function (handler) { | ||
return setTimeout(handler, 16); | ||
}; | ||
@@ -291,3 +296,3 @@ var handlers = new Map([[Array, function arrayHandler(target, source, stack) { | ||
var prev = this.current; | ||
var next = nextRaw instanceof Error ? new Proxy(nextRaw, throwOnAccess) : conform(nextRaw, prev, this.isComponent); | ||
var next = nextRaw instanceof Error ? nextRaw[origId] ? nextRaw : new Proxy(nextRaw, throwOnAccess) : conform(nextRaw, prev, this.isComponent); | ||
@@ -372,5 +377,4 @@ if (prev !== next) { | ||
this._masters = new Set(); | ||
} // if (master.manualReset) this.manualReset = true | ||
} | ||
this._masters.add(master); | ||
@@ -388,8 +392,2 @@ }; | ||
var scheduleNative = typeof requestAnimationFrame === 'function' ? function (handler) { | ||
return requestAnimationFrame(handler); | ||
} : function (handler) { | ||
return setTimeout(handler, 16); | ||
}; | ||
function reap(atom, key, reaping) { | ||
@@ -672,7 +670,7 @@ reaping.delete(atom); | ||
if (definingProperty) { | ||
return this[hk]; | ||
return this[hk].bind(this); | ||
} | ||
var actionFn = createActionMethod(this, hk, context); | ||
definingProperty = true; | ||
var actionFn = createActionMethod(this, hk, context); | ||
Object.defineProperty(this, name, { | ||
@@ -853,2 +851,3 @@ configurable: true, | ||
memkey.manual = memkeyManual; | ||
function cache(data) { | ||
@@ -871,9 +870,44 @@ isForceCache = false; | ||
value: memkey | ||
}, | ||
Wait: { | ||
value: AtomWait // toAtom: {value: toAtom } | ||
} | ||
}); | ||
function defer(proto, name, descr) { | ||
var origFn = descr.value; | ||
if (!origFn) throw new Error('Not a method'); | ||
var definingProperty = false; | ||
function value() { | ||
var _this = this; | ||
if (definingProperty) { | ||
return origFn.bind(this); | ||
} | ||
var fn = function fn() { | ||
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) { | ||
args[_key] = arguments[_key]; | ||
} | ||
scheduleNative(function () { | ||
return origFn.apply(_this, args); | ||
}); | ||
}; | ||
fn.displayName = name + "#defer"; | ||
definingProperty = true; | ||
Object.defineProperty(this, name, { | ||
configurable: true, | ||
value: fn | ||
}); | ||
definingProperty = false; | ||
return fn; | ||
} | ||
return { | ||
enumerable: descr.enumerable, | ||
configurable: descr.configurable, | ||
get: value | ||
}; | ||
} | ||
function stringToColor(str) { | ||
@@ -934,4 +968,6 @@ var hash = 0; | ||
exports.mem = mem; | ||
exports.defer = defer; | ||
exports.ConsoleLogger = ConsoleLogger; | ||
exports.defaultContext = defaultContext; | ||
exports.AtomWait = AtomWait; | ||
//# sourceMappingURL=lom_atom.js.map |
@@ -69,2 +69,7 @@ (function (global, factory) { | ||
} | ||
var scheduleNative = typeof requestAnimationFrame === 'function' ? function (handler) { | ||
return requestAnimationFrame(handler); | ||
} : function (handler) { | ||
return setTimeout(handler, 16); | ||
}; | ||
@@ -293,3 +298,3 @@ var handlers = new Map([[Array, function arrayHandler(target, source, stack) { | ||
var prev = this.current; | ||
var next = nextRaw instanceof Error ? new Proxy(nextRaw, throwOnAccess) : conform(nextRaw, prev, this.isComponent); | ||
var next = nextRaw instanceof Error ? nextRaw[origId] ? nextRaw : new Proxy(nextRaw, throwOnAccess) : conform(nextRaw, prev, this.isComponent); | ||
@@ -374,5 +379,4 @@ if (prev !== next) { | ||
this._masters = new Set(); | ||
} // if (master.manualReset) this.manualReset = true | ||
} | ||
this._masters.add(master); | ||
@@ -390,8 +394,2 @@ }; | ||
var scheduleNative = typeof requestAnimationFrame === 'function' ? function (handler) { | ||
return requestAnimationFrame(handler); | ||
} : function (handler) { | ||
return setTimeout(handler, 16); | ||
}; | ||
function reap(atom, key, reaping) { | ||
@@ -674,7 +672,7 @@ reaping.delete(atom); | ||
if (definingProperty) { | ||
return this[hk]; | ||
return this[hk].bind(this); | ||
} | ||
var actionFn = createActionMethod(this, hk, context); | ||
definingProperty = true; | ||
var actionFn = createActionMethod(this, hk, context); | ||
Object.defineProperty(this, name, { | ||
@@ -855,2 +853,3 @@ configurable: true, | ||
memkey.manual = memkeyManual; | ||
function cache(data) { | ||
@@ -873,9 +872,44 @@ isForceCache = false; | ||
value: memkey | ||
}, | ||
Wait: { | ||
value: AtomWait // toAtom: {value: toAtom } | ||
} | ||
}); | ||
function defer(proto, name, descr) { | ||
var origFn = descr.value; | ||
if (!origFn) throw new Error('Not a method'); | ||
var definingProperty = false; | ||
function value() { | ||
var _this = this; | ||
if (definingProperty) { | ||
return origFn.bind(this); | ||
} | ||
var fn = function fn() { | ||
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) { | ||
args[_key] = arguments[_key]; | ||
} | ||
scheduleNative(function () { | ||
return origFn.apply(_this, args); | ||
}); | ||
}; | ||
fn.displayName = name + "#defer"; | ||
definingProperty = true; | ||
Object.defineProperty(this, name, { | ||
configurable: true, | ||
value: fn | ||
}); | ||
definingProperty = false; | ||
return fn; | ||
} | ||
return { | ||
enumerable: descr.enumerable, | ||
configurable: descr.configurable, | ||
get: value | ||
}; | ||
} | ||
function stringToColor(str) { | ||
@@ -936,4 +970,6 @@ var hash = 0; | ||
exports.mem = mem; | ||
exports.defer = defer; | ||
exports.ConsoleLogger = ConsoleLogger; | ||
exports.defaultContext = defaultContext; | ||
exports.AtomWait = AtomWait; | ||
@@ -940,0 +976,0 @@ Object.defineProperty(exports, '__esModule', { value: true }); |
{ | ||
"name": "lom_atom", | ||
"version": "3.0.8", | ||
"version": "3.0.9", | ||
"description": "Alternative implementation of eigenmethod mol_atom state management library", | ||
@@ -54,11 +54,11 @@ "publishConfig": { | ||
"devDependencies": { | ||
"@babel/core": "^7.0.0-beta.32", | ||
"@babel/plugin-external-helpers": "^7.0.0-beta.32", | ||
"@babel/plugin-proposal-class-properties": "^7.0.0-beta.32", | ||
"@babel/plugin-proposal-decorators": "^7.0.0-beta.32", | ||
"@babel/plugin-transform-flow-strip-types": "^7.0.0-beta.32", | ||
"@babel/preset-es2015": "^7.0.0-beta.32", | ||
"@babel/register": "^7.0.0-beta.32", | ||
"@babel/core": "^7.0.0-beta.34", | ||
"@babel/plugin-external-helpers": "^7.0.0-beta.34", | ||
"@babel/plugin-proposal-class-properties": "^7.0.0-beta.34", | ||
"@babel/plugin-proposal-decorators": "^7.0.0-beta.34", | ||
"@babel/plugin-transform-flow-strip-types": "^7.0.0-beta.34", | ||
"@babel/preset-es2015": "^7.0.0-beta.34", | ||
"@babel/register": "^7.0.0-beta.34", | ||
"chokidar-cli": "^1.2.0", | ||
"flow-bin": "^0.59.0", | ||
"flow-bin": "^0.60.1", | ||
"mocha": "^4.0.1", | ||
@@ -65,0 +65,0 @@ "rimraf": "^2.6.2", |
@@ -218,3 +218,3 @@ // @flow | ||
const next: V | Error = nextRaw instanceof Error | ||
? new Proxy(nextRaw, throwOnAccess) | ||
? ((nextRaw: Object)[origId] ? nextRaw : new Proxy(nextRaw, throwOnAccess)) | ||
: conform(nextRaw, prev, this.isComponent) | ||
@@ -298,5 +298,4 @@ | ||
} | ||
// if (master.manualReset) this.manualReset = true | ||
this._masters.add(master) | ||
} | ||
} |
@@ -10,7 +10,4 @@ // @flow | ||
import {origId, ATOM_STATUS_DESTROYED} from './interfaces' | ||
import {scheduleNative} from './utils' | ||
const scheduleNative: (handler: () => void) => number = typeof requestAnimationFrame === 'function' | ||
? (handler: () => void) => requestAnimationFrame(handler) | ||
: (handler: () => void) => setTimeout(handler, 16) | ||
function reap(atom: IAtomInt, key: IAtomInt, reaping: Set<IAtomInt>) { | ||
@@ -17,0 +14,0 @@ reaping.delete(atom) |
// @flow | ||
export {default as Atom} from './Atom' | ||
export {default as action} from './action' | ||
export {default as detached} from './detached' | ||
export {default as mem} from './mem' | ||
export {default as action} from './decorators/action' | ||
export {default as detached} from './decorators/detached' | ||
export {default as mem} from './decorators/mem' | ||
export {default as defer} from './decorators/defer' | ||
export {default as ConsoleLogger} from './ConsoleLogger' | ||
export {defaultContext} from './Context' | ||
export {AtomWait} from './utils' | ||
@@ -10,0 +12,0 @@ export type { |
@@ -22,1 +22,5 @@ // @flow | ||
} | ||
export const scheduleNative: (handler: () => void) => number = typeof requestAnimationFrame === 'function' | ||
? (handler: () => void) => requestAnimationFrame(handler) | ||
: (handler: () => void) => setTimeout(handler, 16) |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
335700
2.81%25
4.17%3500
3.4%