reactive-box
Advanced tools
Comparing version 0.3.0 to 0.4.0
{ | ||
"name": "reactive-box", | ||
"version": "0.3.0", | ||
"version": "0.4.0", | ||
"description": "Minimalistic, fast, and highly efficient reactivity", | ||
@@ -49,3 +49,3 @@ "scripts": { | ||
"homepage": "https://github.com/betula/reactive-box#readme", | ||
"gitHead": "73c9bcbb36bfc167f35076755c15a826ee9b311c" | ||
"gitHead": "52a8b5852df7306c92347d45e257d5203d3e9452" | ||
} |
declare function box<T>( | ||
initialValue?: T, | ||
onChange?: (currentValue?: T, previousValue?: T) => void, | ||
comparer?: (value?: T, nextValue?: T) => boolean | ||
comparer?: (value: T, nextValue: T) => boolean | ||
): [() => T, (nextValue?: T) => void]; | ||
@@ -9,3 +9,3 @@ | ||
body: T, | ||
comparer?: (value?: T, prevValue?: T) => boolean | ||
comparer?: (value: T, nextValue: T) => boolean | ||
): [T, () => void]; | ||
@@ -12,0 +12,0 @@ |
@@ -100,3 +100,3 @@ /** | ||
try { | ||
cache = body.call(last_context); | ||
return body.call(last_context); | ||
} finally { | ||
@@ -107,5 +107,6 @@ context_node = stack; | ||
const sel_node = [new Set(), new Set(), 0, () => { | ||
let prev = cache; | ||
run(); | ||
return !comparer(cache, prev); | ||
let next = run(); | ||
return comparer(cache, next) | ||
? false | ||
: ((cache = next), true); | ||
}]; | ||
@@ -117,3 +118,3 @@ return [ | ||
if (!sel_node[2]) { | ||
run(); | ||
cache = run(); | ||
sel_node[2] = 1; | ||
@@ -120,0 +121,0 @@ } |
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
9145
159