release: WRNexusJS 0.2.49
This commit is contained in:
@@ -214,59 +214,6 @@ export const REACTIVE_RUNTIME = String.raw`
|
||||
var value = initial;
|
||||
var subscribers = new Set();
|
||||
var notifying = false;
|
||||
var pendingNotification = false;
|
||||
var pendingPrevious;
|
||||
|
||||
function notify(previous) {
|
||||
if (notifying) {
|
||||
pendingNotification = true;
|
||||
|
||||
if (pendingPrevious === undefined) {
|
||||
pendingPrevious = previous;
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
notifying = true;
|
||||
|
||||
try {
|
||||
/*
|
||||
* Iterate a snapshot. Reactive renderers may subscribe again while
|
||||
* running, but that must not mutate the collection currently being
|
||||
* iterated.
|
||||
*/
|
||||
var snapshot =
|
||||
Array.from(subscribers);
|
||||
|
||||
snapshot.forEach(function (
|
||||
subscriber,
|
||||
) {
|
||||
if (
|
||||
subscribers.has(
|
||||
subscriber,
|
||||
)
|
||||
) {
|
||||
subscriber(
|
||||
value,
|
||||
previous,
|
||||
);
|
||||
}
|
||||
});
|
||||
} finally {
|
||||
notifying = false;
|
||||
}
|
||||
|
||||
if (pendingNotification) {
|
||||
var nextPrevious =
|
||||
pendingPrevious;
|
||||
|
||||
pendingNotification = false;
|
||||
pendingPrevious = undefined;
|
||||
|
||||
notify(nextPrevious);
|
||||
}
|
||||
}
|
||||
|
||||
return {
|
||||
get: function () {
|
||||
@@ -286,7 +233,46 @@ export const REACTIVE_RUNTIME = String.raw`
|
||||
var previous = value;
|
||||
value = nextValue;
|
||||
|
||||
notify(previous);
|
||||
/*
|
||||
* Prevent nested synchronous notification of the
|
||||
* same signal.
|
||||
*/
|
||||
if (notifying) {
|
||||
return;
|
||||
}
|
||||
|
||||
notifying = true;
|
||||
|
||||
try {
|
||||
/*
|
||||
* Always iterate a snapshot. A renderer can read
|
||||
* this signal and subscribe again while it runs.
|
||||
*/
|
||||
var snapshot =
|
||||
Array.from(subscribers);
|
||||
|
||||
for (
|
||||
var index = 0;
|
||||
index < snapshot.length;
|
||||
index++
|
||||
) {
|
||||
var subscriber =
|
||||
snapshot[index];
|
||||
|
||||
if (
|
||||
subscribers.has(
|
||||
subscriber,
|
||||
)
|
||||
) {
|
||||
subscriber(
|
||||
value,
|
||||
previous,
|
||||
);
|
||||
}
|
||||
}
|
||||
} finally {
|
||||
notifying = false;
|
||||
}
|
||||
},
|
||||
|
||||
subscribe: function (
|
||||
|
||||
Reference in New Issue
Block a user