mobservable
Advanced tools
Comparing version 1.1.2 to 1.1.3
@@ -0,1 +1,5 @@ | ||
# 1.1.3 | ||
* Fixed #61; if autorun was created during a transaction, postpone execution until the end of the transaction | ||
# 1.1.2 | ||
@@ -2,0 +6,0 @@ |
@@ -85,5 +85,15 @@ /** | ||
}, mode === ValueMode.Structure); | ||
observable.setRefCount(+1); | ||
var disposedPrematurely = false; | ||
var started = false; | ||
dnode_2.runAfterTransaction(function () { | ||
if (!disposedPrematurely) { | ||
observable.setRefCount(+1); | ||
started = true; | ||
} | ||
}); | ||
var disposer = utils_1.once(function () { | ||
observable.setRefCount(-1); | ||
if (started) | ||
observable.setRefCount(-1); | ||
else | ||
disposedPrematurely = true; | ||
}); | ||
@@ -90,0 +100,0 @@ disposer.$mobservable = observable; |
export declare function checkIfStateIsBeingModifiedDuringView(context: IContextInfoStruct): void; | ||
export declare function transaction<T>(action: () => T): T; | ||
export declare function runAfterTransaction(action: () => void): void; | ||
export declare function untracked<T>(action: () => T): T; | ||
@@ -4,0 +5,0 @@ export declare enum NodeState { |
@@ -16,2 +16,3 @@ /** | ||
var changedValues = []; | ||
var afterTransactionItems = []; | ||
var mobservableId = 0; | ||
@@ -38,2 +39,5 @@ function checkIfStateIsBeingModifiedDuringView(context) { | ||
throw new Error("[mobservable] Illegal State, please file a bug report"); | ||
var actions = afterTransactionItems.splice(0, afterTransactionItems.length); | ||
for (var i = 0, l = actions.length; i < l; i++) | ||
actions[i](); | ||
} | ||
@@ -43,2 +47,9 @@ } | ||
exports.transaction = transaction; | ||
function runAfterTransaction(action) { | ||
if (inTransaction === 0) | ||
action(); | ||
else | ||
afterTransactionItems.push(action); | ||
} | ||
exports.runAfterTransaction = runAfterTransaction; | ||
function untracked(action) { | ||
@@ -45,0 +56,0 @@ try { |
{ | ||
"name": "mobservable", | ||
"version": "1.1.2", | ||
"version": "1.1.3", | ||
"description": "Observable data. Reactive functions. Simple code.", | ||
@@ -5,0 +5,0 @@ "main": "lib/index.js", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
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
172108
2101