nemo-observable-util
Advanced tools
Comparing version 5.2.0 to 5.3.0
@@ -84,4 +84,5 @@ 'use strict'; | ||
StackManager.prototype.getUUID = function getUUID () { | ||
return this.uuid++; | ||
StackManager.prototype.getUUID = function getUUID (suffix) { | ||
var current = this.uuid++; | ||
return [current, suffix || ''].join('@@'); | ||
}; | ||
@@ -100,3 +101,5 @@ | ||
if (!this.duringStack) { | ||
this.onFlush && this.onFlush(); | ||
var ref = typeof lastStack === 'string' ? lastStack.split('@@') : []; | ||
var suffix = ref[1]; | ||
this.onFlush && this.onFlush(suffix); | ||
} | ||
@@ -195,3 +198,3 @@ }; | ||
this.flush = function () { | ||
this.flush = function (actionName) { | ||
// copy incase being modified during exec reaction | ||
@@ -202,3 +205,3 @@ var todoCopy = this$1.runners; | ||
for (var [reaction, operation] of todoCopy.entries()) { | ||
queueReaction(reaction, operation); | ||
queueReaction(reaction, operation, actionName); | ||
} | ||
@@ -274,3 +277,3 @@ }; | ||
} | ||
var transactionFn = createTransaction(originalFunc); | ||
var transactionFn = createTransaction.apply(void 0, [ originalFunc ].concat( restNames )); | ||
var identity = actionManager.getUUID(); | ||
@@ -379,3 +382,3 @@ function wrapper() { | ||
} | ||
var identity = transactionManager.getUUID(); | ||
var identity = transactionManager.getUUID(restNames.join('')); | ||
function wrapper() { | ||
@@ -456,11 +459,11 @@ var args = [], len = arguments.length; | ||
function queueReaction(reaction, operation) { | ||
function queueReaction(reaction, operation, actionName) { | ||
debugOperation(reaction, operation); | ||
// queue the reaction for later execution or run it immediately | ||
if (typeof reaction.scheduler === 'function') { | ||
reaction.scheduler(reaction); | ||
reaction.scheduler(reaction, actionName); | ||
} else if (typeof reaction.scheduler === 'object') { | ||
reaction.scheduler.add(reaction); | ||
} else { | ||
reaction(); | ||
reaction(actionName); | ||
} | ||
@@ -467,0 +470,0 @@ } |
@@ -75,4 +75,5 @@ 'use strict'; | ||
getUUID() { | ||
return this.uuid++; | ||
getUUID(suffix) { | ||
const current = this.uuid++; | ||
return [current, suffix || ''].join('@@'); | ||
} | ||
@@ -91,3 +92,4 @@ | ||
if (!this.duringStack) { | ||
this.onFlush && this.onFlush(); | ||
const [, suffix] = typeof lastStack === 'string' ? lastStack.split('@@') : []; | ||
this.onFlush && this.onFlush(suffix); | ||
} | ||
@@ -172,3 +174,3 @@ } | ||
constructor() { | ||
this.flush = () => { | ||
this.flush = actionName => { | ||
// copy incase being modified during exec reaction | ||
@@ -179,3 +181,3 @@ const todoCopy = this.runners; | ||
for (const [reaction, operation] of todoCopy.entries()) { | ||
queueReaction(reaction, operation); | ||
queueReaction(reaction, operation, actionName); | ||
} | ||
@@ -243,3 +245,3 @@ }; | ||
} | ||
const transactionFn = createTransaction(originalFunc); | ||
const transactionFn = createTransaction(originalFunc, ...restNames); | ||
const identity = actionManager.getUUID(); | ||
@@ -336,3 +338,3 @@ function wrapper(...args) { | ||
} | ||
const identity = transactionManager.getUUID(); | ||
const identity = transactionManager.getUUID(restNames.join('')); | ||
function wrapper(...args) { | ||
@@ -410,11 +412,11 @@ transactionManager.start(identity); | ||
function queueReaction(reaction, operation) { | ||
function queueReaction(reaction, operation, actionName) { | ||
debugOperation(reaction, operation); | ||
// queue the reaction for later execution or run it immediately | ||
if (typeof reaction.scheduler === 'function') { | ||
reaction.scheduler(reaction); | ||
reaction.scheduler(reaction, actionName); | ||
} else if (typeof reaction.scheduler === 'object') { | ||
reaction.scheduler.add(reaction); | ||
} else { | ||
reaction(); | ||
reaction(actionName); | ||
} | ||
@@ -421,0 +423,0 @@ } |
@@ -80,4 +80,5 @@ var connectionStore = new WeakMap(); | ||
StackManager.prototype.getUUID = function getUUID () { | ||
return this.uuid++; | ||
StackManager.prototype.getUUID = function getUUID (suffix) { | ||
var current = this.uuid++; | ||
return [current, suffix || ''].join('@@'); | ||
}; | ||
@@ -96,3 +97,5 @@ | ||
if (!this.duringStack) { | ||
this.onFlush && this.onFlush(); | ||
var ref = typeof lastStack === 'string' ? lastStack.split('@@') : []; | ||
var suffix = ref[1]; | ||
this.onFlush && this.onFlush(suffix); | ||
} | ||
@@ -191,3 +194,3 @@ }; | ||
this.flush = function () { | ||
this.flush = function (actionName) { | ||
// copy incase being modified during exec reaction | ||
@@ -198,3 +201,3 @@ var todoCopy = this$1.runners; | ||
for (var [reaction, operation] of todoCopy.entries()) { | ||
queueReaction(reaction, operation); | ||
queueReaction(reaction, operation, actionName); | ||
} | ||
@@ -270,3 +273,3 @@ }; | ||
} | ||
var transactionFn = createTransaction(originalFunc); | ||
var transactionFn = createTransaction.apply(void 0, [ originalFunc ].concat( restNames )); | ||
var identity = actionManager.getUUID(); | ||
@@ -375,3 +378,3 @@ function wrapper() { | ||
} | ||
var identity = transactionManager.getUUID(); | ||
var identity = transactionManager.getUUID(restNames.join('')); | ||
function wrapper() { | ||
@@ -452,11 +455,11 @@ var args = [], len = arguments.length; | ||
function queueReaction(reaction, operation) { | ||
function queueReaction(reaction, operation, actionName) { | ||
debugOperation(reaction, operation); | ||
// queue the reaction for later execution or run it immediately | ||
if (typeof reaction.scheduler === 'function') { | ||
reaction.scheduler(reaction); | ||
reaction.scheduler(reaction, actionName); | ||
} else if (typeof reaction.scheduler === 'object') { | ||
reaction.scheduler.add(reaction); | ||
} else { | ||
reaction(); | ||
reaction(actionName); | ||
} | ||
@@ -463,0 +466,0 @@ } |
@@ -71,4 +71,5 @@ const connectionStore = new WeakMap(); | ||
getUUID() { | ||
return this.uuid++; | ||
getUUID(suffix) { | ||
const current = this.uuid++; | ||
return [current, suffix || ''].join('@@'); | ||
} | ||
@@ -87,3 +88,4 @@ | ||
if (!this.duringStack) { | ||
this.onFlush && this.onFlush(); | ||
const [, suffix] = typeof lastStack === 'string' ? lastStack.split('@@') : []; | ||
this.onFlush && this.onFlush(suffix); | ||
} | ||
@@ -168,3 +170,3 @@ } | ||
constructor() { | ||
this.flush = () => { | ||
this.flush = actionName => { | ||
// copy incase being modified during exec reaction | ||
@@ -175,3 +177,3 @@ const todoCopy = this.runners; | ||
for (const [reaction, operation] of todoCopy.entries()) { | ||
queueReaction(reaction, operation); | ||
queueReaction(reaction, operation, actionName); | ||
} | ||
@@ -239,3 +241,3 @@ }; | ||
} | ||
const transactionFn = createTransaction(originalFunc); | ||
const transactionFn = createTransaction(originalFunc, ...restNames); | ||
const identity = actionManager.getUUID(); | ||
@@ -332,3 +334,3 @@ function wrapper(...args) { | ||
} | ||
const identity = transactionManager.getUUID(); | ||
const identity = transactionManager.getUUID(restNames.join('')); | ||
function wrapper(...args) { | ||
@@ -406,11 +408,11 @@ transactionManager.start(identity); | ||
function queueReaction(reaction, operation) { | ||
function queueReaction(reaction, operation, actionName) { | ||
debugOperation(reaction, operation); | ||
// queue the reaction for later execution or run it immediately | ||
if (typeof reaction.scheduler === 'function') { | ||
reaction.scheduler(reaction); | ||
reaction.scheduler(reaction, actionName); | ||
} else if (typeof reaction.scheduler === 'object') { | ||
reaction.scheduler.add(reaction); | ||
} else { | ||
reaction(); | ||
reaction(actionName); | ||
} | ||
@@ -417,0 +419,0 @@ } |
{ | ||
"name": "nemo-observable-util", | ||
"version": "5.2.0", | ||
"version": "5.3.0", | ||
"description": "Simple transparent reactivity with 100% language coverage. Made with ES6 Proxies.", | ||
@@ -5,0 +5,0 @@ "main": "dist/cjs.es5.js", |
@@ -1,3 +0,1 @@ | ||
import { action } from 'nemo-observable-util'; | ||
declare module 'nemo-observable-util' { | ||
@@ -4,0 +2,0 @@ function observable<Observable extends object>(obj?: Observable): Observable; |
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
127018
2920