Comparing version 0.4.2 to 0.4.3
@@ -5,3 +5,3 @@ // Public interface | ||
if (owner === null) | ||
throw new Error("all computations must be created under a parent computation or root"); | ||
console.warn("computations created without a root or parent cannot be disposed"); | ||
var node = new ComputationNode(fn, value); | ||
@@ -15,3 +15,3 @@ Owner = RunningNode = node; | ||
} | ||
if (owner !== UNOWNED) { | ||
if (owner && owner !== UNOWNED) { | ||
if (owner.owned === null) | ||
@@ -135,3 +135,3 @@ owner.owned = [node]; | ||
if (age === time) | ||
throw new Error("conflicting values: " + value + " is not the same as " + current); | ||
throw new Error("conflicting values: " + update + " is not the same as " + current); | ||
age = time; | ||
@@ -138,0 +138,0 @@ current = update; |
@@ -5,3 +5,3 @@ // Public interface | ||
if (owner === null) | ||
throw new Error("all computations must be created under a parent computation or root"); | ||
console.warn("computations created without a root or parent cannot be disposed"); | ||
var node = new ComputationNode(clock, fn, value); | ||
@@ -15,3 +15,3 @@ Owner = RunningNode = node; | ||
} | ||
if (owner !== UNOWNED) { | ||
if (owner && owner !== UNOWNED) { | ||
if (owner.owned === null) | ||
@@ -192,3 +192,3 @@ owner.owned = [node]; | ||
if (age === time) | ||
throw new Error("conflicting values: " + value + " is not the same as " + current); | ||
throw new Error("conflicting values: " + update + " is not the same as " + current); | ||
age = time; | ||
@@ -195,0 +195,0 @@ current = update; |
@@ -11,3 +11,3 @@ (function (global, factory) { | ||
if (owner === null) | ||
throw new Error("all computations must be created under a parent computation or root"); | ||
console.warn("computations created without a root or parent cannot be disposed"); | ||
var node = new ComputationNode(fn, value); | ||
@@ -21,3 +21,3 @@ Owner = RunningNode = node; | ||
} | ||
if (owner !== UNOWNED) { | ||
if (owner && owner !== UNOWNED) { | ||
if (owner.owned === null) | ||
@@ -140,3 +140,3 @@ owner.owned = [node]; | ||
if (age === time) | ||
throw new Error("conflicting values: " + value + " is not the same as " + current); | ||
throw new Error("conflicting values: " + update + " is not the same as " + current); | ||
age = time; | ||
@@ -143,0 +143,0 @@ current = update; |
@@ -11,3 +11,3 @@ (function (global, factory) { | ||
if (owner === null) | ||
throw new Error("all computations must be created under a parent computation or root"); | ||
console.warn("computations created without a root or parent cannot be disposed"); | ||
var node = new ComputationNode(clock, fn, value); | ||
@@ -21,3 +21,3 @@ Owner = RunningNode = node; | ||
} | ||
if (owner !== UNOWNED) { | ||
if (owner && owner !== UNOWNED) { | ||
if (owner.owned === null) | ||
@@ -197,3 +197,3 @@ owner.owned = [node]; | ||
if (age === time) | ||
throw new Error("conflicting values: " + value + " is not the same as " + current); | ||
throw new Error("conflicting values: " + update + " is not the same as " + current); | ||
age = time; | ||
@@ -200,0 +200,0 @@ current = update; |
{ | ||
"name": "s-js", | ||
"version": "0.4.2", | ||
"version": "0.4.3", | ||
"description": "S.js - simple, clean, fast reactive programming in Javascript", | ||
@@ -5,0 +5,0 @@ "main": "dist/S.js", |
@@ -42,7 +42,7 @@ /* globals S, describe, it, expect */ | ||
it("is necessary to create a toplevel computation", function () { | ||
expect(() => { | ||
S(() => 1) | ||
}).toThrowError(/root/); | ||
}); | ||
//it("is necessary to create a toplevel computation", function () { | ||
// expect(() => { | ||
// S(() => 1) | ||
// }).toThrowError(/root/); | ||
//}); | ||
@@ -49,0 +49,0 @@ it("does not freeze updates when used at top level", function () { |
@@ -36,3 +36,3 @@ | ||
if (owner === null) throw new Error("all computations must be created under a parent computation or root"); | ||
if (owner === null) console.warn("computations created without a root or parent will never be disposed"); | ||
@@ -49,3 +49,3 @@ var node = new ComputationNode(fn, value); | ||
if (owner !== UNOWNED) { | ||
if (owner && owner !== UNOWNED) { | ||
if (owner.owned === null) owner.owned = [node]; | ||
@@ -174,3 +174,3 @@ else owner.owned.push(node); | ||
if (age === time) | ||
throw new Error("conflicting values: " + value + " is not the same as " + current); | ||
throw new Error("conflicting values: " + update + " is not the same as " + current); | ||
age = time; | ||
@@ -225,3 +225,3 @@ current = update!; | ||
} else { | ||
throw new Error("S.cleanup() must be called from within an S() computation. Cannot call it at toplevel."); | ||
console.warn("cleanups created without a root or parent will never be run"); | ||
} | ||
@@ -228,0 +228,0 @@ }; |
@@ -41,3 +41,3 @@ | ||
if (owner === null) throw new Error("all computations must be created under a parent computation or root"); | ||
if (owner === null) console.warn("computations created without a root or parent cannot be disposed"); | ||
@@ -54,3 +54,3 @@ var node = new ComputationNode(clock, fn, value); | ||
if (owner !== UNOWNED) { | ||
if (owner && owner !== UNOWNED) { | ||
if (owner.owned === null) owner.owned = [node]; | ||
@@ -237,3 +237,3 @@ else owner.owned.push(node); | ||
if (age === time) | ||
throw new Error("conflicting values: " + value + " is not the same as " + current); | ||
throw new Error("conflicting values: " + update + " is not the same as " + current); | ||
age = time; | ||
@@ -288,3 +288,3 @@ current = update!; | ||
} else { | ||
throw new Error("S.cleanup() must be called from within an S() computation. Cannot call it at toplevel."); | ||
console.warn("cleanups created without a root or parent will never be run"); | ||
} | ||
@@ -291,0 +291,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
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
1
178227