Comparing version 2.3.9 to 2.3.10
@@ -71,2 +71,3 @@ "use strict"; | ||
this.isBeingTracked = false; | ||
this.reactions.clear(); | ||
this.onBecomeUnobservedHandler(); | ||
@@ -73,0 +74,0 @@ } |
@@ -66,3 +66,3 @@ "use strict"; | ||
function fetchName(name) { | ||
return __awaiter(this, void 0, void 0, /*#__PURE__*/regeneratorRuntime.mark(function _callee() { | ||
return __awaiter(this, void 0, void 0, regeneratorRuntime.mark(function _callee() { | ||
return regeneratorRuntime.wrap(function _callee$(_context) { | ||
@@ -87,3 +87,3 @@ while (1) { | ||
function fetchAge(age) { | ||
return __awaiter(this, void 0, void 0, /*#__PURE__*/regeneratorRuntime.mark(function _callee2() { | ||
return __awaiter(this, void 0, void 0, regeneratorRuntime.mark(function _callee2() { | ||
return regeneratorRuntime.wrap(function _callee2$(_context2) { | ||
@@ -118,3 +118,3 @@ while (1) { | ||
this.name = computed_async_1.computedAsync("", function () { | ||
return __awaiter(_this, void 0, void 0, /*#__PURE__*/regeneratorRuntime.mark(function _callee3() { | ||
return __awaiter(_this, void 0, void 0, regeneratorRuntime.mark(function _callee3() { | ||
return regeneratorRuntime.wrap(function _callee3$(_context3) { | ||
@@ -139,3 +139,3 @@ while (1) { | ||
this.age = computed_async_1.computedAsync("", function () { | ||
return __awaiter(_this, void 0, void 0, /*#__PURE__*/regeneratorRuntime.mark(function _callee4() { | ||
return __awaiter(_this, void 0, void 0, regeneratorRuntime.mark(function _callee4() { | ||
return regeneratorRuntime.wrap(function _callee4$(_context4) { | ||
@@ -142,0 +142,0 @@ while (1) { |
@@ -66,3 +66,3 @@ "use strict"; | ||
return function (dispatch, getState) { | ||
return __awaiter(_this, void 0, void 0, /*#__PURE__*/regeneratorRuntime.mark(function _callee() { | ||
return __awaiter(_this, void 0, void 0, regeneratorRuntime.mark(function _callee() { | ||
return regeneratorRuntime.wrap(function _callee$(_context) { | ||
@@ -69,0 +69,0 @@ while (1) { |
@@ -23,3 +23,3 @@ "use strict"; | ||
if (utils_1.isPrimitive(obj)) { | ||
throw Error(obj + " \u662F\u57FA\u672C\u7C7B\u578B\uFF0Cdob \u4EC5\u652F\u6301\u975E\u57FA\u672C\u7C7B\u578B"); | ||
throw TypeError(obj + " \u662F\u57FA\u672C\u7C7B\u578B\uFF0Cdob \u4EC5\u652F\u6301\u975E\u57FA\u672C\u7C7B\u578B"); | ||
} | ||
@@ -26,0 +26,0 @@ if (utils_1.globalState.proxies.has(obj)) { |
@@ -27,2 +27,7 @@ "use strict"; | ||
_createClass(Clock, [{ | ||
key: "stopAtom", | ||
value: function stopAtom() { | ||
this.atom.unobserve(); | ||
} | ||
}, { | ||
key: "getTime", | ||
@@ -63,2 +68,15 @@ value: function getTime() { | ||
}); | ||
ava_1.default("unobservable", function (t) { | ||
var time = 0; | ||
var clock = new Clock(); | ||
index_1.observe(function () { | ||
time = clock.getTime(); | ||
}); | ||
clock.startTicking(); | ||
clock.startTicking(); | ||
clock.stopAtom(); | ||
return Promise.resolve().then(function () { | ||
return t.true(time === 4); | ||
}); | ||
}); | ||
//# sourceMappingURL=atom.test.js.map |
@@ -81,2 +81,12 @@ "use strict"; | ||
}); | ||
ava_1.default("null throw typeError", function (t) { | ||
t.throws(function () { | ||
index_1.observable(null); | ||
}, TypeError); | ||
}); | ||
ava_1.default("undefined not throw", function (t) { | ||
t.notThrows(function () { | ||
index_1.observable(undefined); | ||
}); | ||
}); | ||
/** | ||
@@ -271,3 +281,3 @@ * isObservable | ||
value: function run(num) { | ||
return __awaiter(this, void 0, void 0, /*#__PURE__*/regeneratorRuntime.mark(function _callee() { | ||
return __awaiter(this, void 0, void 0, regeneratorRuntime.mark(function _callee() { | ||
return regeneratorRuntime.wrap(function _callee$(_context) { | ||
@@ -998,3 +1008,3 @@ while (1) { | ||
index_1.Action(function () { | ||
return __awaiter(undefined, void 0, void 0, /*#__PURE__*/regeneratorRuntime.mark(function _callee2() { | ||
return __awaiter(undefined, void 0, void 0, regeneratorRuntime.mark(function _callee2() { | ||
return regeneratorRuntime.wrap(function _callee2$(_context2) { | ||
@@ -1042,3 +1052,3 @@ while (1) { | ||
index_1.Action(function () { | ||
return __awaiter(undefined, void 0, void 0, /*#__PURE__*/regeneratorRuntime.mark(function _callee3() { | ||
return __awaiter(undefined, void 0, void 0, regeneratorRuntime.mark(function _callee3() { | ||
return regeneratorRuntime.wrap(function _callee3$(_context3) { | ||
@@ -1045,0 +1055,0 @@ while (1) { |
{ | ||
"name": "dob", | ||
"version": "2.3.9", | ||
"version": "2.3.10", | ||
"description": "", | ||
@@ -54,8 +54,7 @@ "main": "built/index.js", | ||
"typescript": "^2.4.1", | ||
"webpack": "^3.3.0" | ||
"webpack": "^3.3.0", | ||
"react": "^15.6.1" | ||
}, | ||
"dependencies": { | ||
"immutable": "^3.8.1", | ||
"lodash": "^4.17.4", | ||
"react": "^15.6.1", | ||
"redux": "^3.7.2" | ||
@@ -62,0 +61,0 @@ }, |
@@ -61,4 +61,5 @@ import { endBatch, runReactionAsync, startBatch } from "./observer" | ||
this.isBeingTracked = false | ||
this.reactions.clear() | ||
this.onBecomeUnobservedHandler() | ||
} | ||
} |
@@ -19,3 +19,3 @@ import builtIns from "./built-ins" | ||
if (isPrimitive(obj)) { | ||
throw Error(`${obj} 是基本类型,dob 仅支持非基本类型`) | ||
throw TypeError(`${obj} 是基本类型,dob 仅支持非基本类型`) | ||
} | ||
@@ -22,0 +22,0 @@ |
@@ -16,2 +16,6 @@ import test from "ava" | ||
public stopAtom() { | ||
this.atom.unobserve() | ||
} | ||
public getTime() { | ||
@@ -47,1 +51,16 @@ this.atom.reportObserved() | ||
}) | ||
test("unobservable", t => { | ||
let time: number = 0 | ||
const clock = new Clock() | ||
observe(() => { | ||
time = clock.getTime() | ||
}) | ||
clock.startTicking() | ||
clock.startTicking() | ||
clock.stopAtom() | ||
return Promise.resolve() | ||
.then(() => t.true(time === 4)) | ||
}) |
@@ -42,2 +42,14 @@ import test from "ava" | ||
test("null throw typeError", t => { | ||
t.throws(() => { | ||
observable(null) | ||
}, TypeError) | ||
}) | ||
test("undefined not throw", t => { | ||
t.notThrows(() => { | ||
observable(undefined) | ||
}) | ||
}) | ||
/** | ||
@@ -44,0 +56,0 @@ * isObservable |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Mixed license
License(Experimental) Package contains multiple licenses.
Found 1 instance in 1 package
496668
2
109
6617
25
1
- Removedlodash@^4.17.4
- Removedreact@^15.6.1
- Removedasap@2.0.6(transitive)
- Removedcore-js@1.2.7(transitive)
- Removedcreate-react-class@15.7.0(transitive)
- Removedencoding@0.1.13(transitive)
- Removedfbjs@0.8.18(transitive)
- Removediconv-lite@0.6.3(transitive)
- Removedis-stream@1.1.0(transitive)
- Removedisomorphic-fetch@2.2.1(transitive)
- Removednode-fetch@1.7.3(transitive)
- Removedobject-assign@4.1.1(transitive)
- Removedpromise@7.3.1(transitive)
- Removedprop-types@15.8.1(transitive)
- Removedreact@15.7.0(transitive)
- Removedreact-is@16.13.1(transitive)
- Removedsafer-buffer@2.1.2(transitive)
- Removedsetimmediate@1.0.5(transitive)
- Removedua-parser-js@0.7.40(transitive)
- Removedwhatwg-fetch@3.6.20(transitive)