@maverick-js/signals
Advanced tools
Comparing version 5.11.5 to 6.0.0
@@ -159,17 +159,14 @@ import { SCOPE } from './symbols.js'; | ||
throw error; | ||
let i = 0, len = scope._handlers.length, coercedError = coerceError(error); | ||
let i = 0, len = scope._handlers.length, currentError = error; | ||
for (i = 0; i < len; i++) { | ||
try { | ||
scope._handlers[i](coercedError); | ||
scope._handlers[i](currentError); | ||
break; | ||
} catch (error2) { | ||
coercedError = coerceError(error2); | ||
currentError = error2; | ||
} | ||
} | ||
if (i === len) | ||
throw coercedError; | ||
throw currentError; | ||
} | ||
function coerceError(error) { | ||
return error instanceof Error ? error : Error(JSON.stringify(error)); | ||
} | ||
function read() { | ||
@@ -288,25 +285,3 @@ if (this._state === STATE_DISPOSED) | ||
const result = compute(node, node._compute, node); | ||
if (currentObservers) { | ||
if (node._sources) | ||
removeSourceObservers(node, currentObserversIndex); | ||
if (node._sources && currentObserversIndex > 0) { | ||
node._sources.length = currentObserversIndex + currentObservers.length; | ||
for (let i = 0; i < currentObservers.length; i++) { | ||
node._sources[currentObserversIndex + i] = currentObservers[i]; | ||
} | ||
} else { | ||
node._sources = currentObservers; | ||
} | ||
let source; | ||
for (let i = currentObserversIndex; i < node._sources.length; i++) { | ||
source = node._sources[i]; | ||
if (!source._observers) | ||
source._observers = [node]; | ||
else | ||
source._observers.push(node); | ||
} | ||
} else if (node._sources && currentObserversIndex < node._sources.length) { | ||
removeSourceObservers(node, currentObserversIndex); | ||
node._sources.length = currentObserversIndex; | ||
} | ||
updateObservers(node); | ||
if (!node._effect && node._init) { | ||
@@ -331,13 +306,34 @@ write.call(node, result); | ||
} | ||
updateObservers(node); | ||
handleError(node, error); | ||
if (node._state === STATE_DIRTY) { | ||
cleanup(node); | ||
if (node._sources) | ||
removeSourceObservers(node, 0); | ||
} finally { | ||
currentObservers = prevObservers; | ||
currentObserversIndex = prevObserversIndex; | ||
node._state = STATE_CLEAN; | ||
} | ||
} | ||
function updateObservers(node) { | ||
if (currentObservers) { | ||
if (node._sources) | ||
removeSourceObservers(node, currentObserversIndex); | ||
if (node._sources && currentObserversIndex > 0) { | ||
node._sources.length = currentObserversIndex + currentObservers.length; | ||
for (let i = 0; i < currentObservers.length; i++) { | ||
node._sources[currentObserversIndex + i] = currentObservers[i]; | ||
} | ||
} else { | ||
node._sources = currentObservers; | ||
} | ||
return; | ||
let source; | ||
for (let i = currentObserversIndex; i < node._sources.length; i++) { | ||
source = node._sources[i]; | ||
if (!source._observers) | ||
source._observers = [node]; | ||
else | ||
source._observers.push(node); | ||
} | ||
} else if (node._sources && currentObserversIndex < node._sources.length) { | ||
removeSourceObservers(node, currentObserversIndex); | ||
node._sources.length = currentObserversIndex; | ||
} | ||
currentObservers = prevObservers; | ||
currentObserversIndex = prevObserversIndex; | ||
node._state = STATE_CLEAN; | ||
} | ||
@@ -344,0 +340,0 @@ function notify(node, state) { |
@@ -159,17 +159,14 @@ import { SCOPE } from './symbols.js'; | ||
throw error; | ||
let i = 0, len = scope.$eh.length, coercedError = coerceError(error); | ||
let i = 0, len = scope.$eh.length, currentError = error; | ||
for (i = 0; i < len; i++) { | ||
try { | ||
scope.$eh[i](coercedError); | ||
scope.$eh[i](currentError); | ||
break; | ||
} catch (error2) { | ||
coercedError = coerceError(error2); | ||
currentError = error2; | ||
} | ||
} | ||
if (i === len) | ||
throw coercedError; | ||
throw currentError; | ||
} | ||
function coerceError(error) { | ||
return error instanceof Error ? error : Error(JSON.stringify(error)); | ||
} | ||
function read() { | ||
@@ -287,25 +284,3 @@ if (this.$st === STATE_DISPOSED) | ||
const result = compute(node, node.$c, node); | ||
if (currentObservers) { | ||
if (node.$s) | ||
removeSourceObservers(node, currentObserversIndex); | ||
if (node.$s && currentObserversIndex > 0) { | ||
node.$s.length = currentObserversIndex + currentObservers.length; | ||
for (let i = 0; i < currentObservers.length; i++) { | ||
node.$s[currentObserversIndex + i] = currentObservers[i]; | ||
} | ||
} else { | ||
node.$s = currentObservers; | ||
} | ||
let source; | ||
for (let i = currentObserversIndex; i < node.$s.length; i++) { | ||
source = node.$s[i]; | ||
if (!source.$o) | ||
source.$o = [node]; | ||
else | ||
source.$o.push(node); | ||
} | ||
} else if (node.$s && currentObserversIndex < node.$s.length) { | ||
removeSourceObservers(node, currentObserversIndex); | ||
node.$s.length = currentObserversIndex; | ||
} | ||
updateObservers(node); | ||
if (!node.$e && node.$i) { | ||
@@ -318,13 +293,34 @@ write.call(node, result); | ||
} catch (error) { | ||
updateObservers(node); | ||
handleError(node, error); | ||
if (node.$st === STATE_DIRTY) { | ||
cleanup(node); | ||
if (node.$s) | ||
removeSourceObservers(node, 0); | ||
} finally { | ||
currentObservers = prevObservers; | ||
currentObserversIndex = prevObserversIndex; | ||
node.$st = STATE_CLEAN; | ||
} | ||
} | ||
function updateObservers(node) { | ||
if (currentObservers) { | ||
if (node.$s) | ||
removeSourceObservers(node, currentObserversIndex); | ||
if (node.$s && currentObserversIndex > 0) { | ||
node.$s.length = currentObserversIndex + currentObservers.length; | ||
for (let i = 0; i < currentObservers.length; i++) { | ||
node.$s[currentObserversIndex + i] = currentObservers[i]; | ||
} | ||
} else { | ||
node.$s = currentObservers; | ||
} | ||
return; | ||
let source; | ||
for (let i = currentObserversIndex; i < node.$s.length; i++) { | ||
source = node.$s[i]; | ||
if (!source.$o) | ||
source.$o = [node]; | ||
else | ||
source.$o.push(node); | ||
} | ||
} else if (node.$s && currentObserversIndex < node.$s.length) { | ||
removeSourceObservers(node, currentObserversIndex); | ||
node.$s.length = currentObserversIndex; | ||
} | ||
currentObservers = prevObservers; | ||
currentObserversIndex = prevObserversIndex; | ||
node.$st = STATE_CLEAN; | ||
} | ||
@@ -331,0 +327,0 @@ function notify(node, state) { |
@@ -5,3 +5,3 @@ { | ||
"license": "MIT", | ||
"version": "5.11.5", | ||
"version": "6.0.0", | ||
"type": "module", | ||
@@ -8,0 +8,0 @@ "types": "dist/types/index.d.ts", |
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
63672
1405