mobservable
Advanced tools
Comparing version 1.1.3 to 1.1.4
@@ -0,1 +1,5 @@ | ||
# 1.1.4 | ||
* Fixed #65; illegal state exception when using a transaction inside a reactive function. Credits: @kmalakoff | ||
# 1.1.3 | ||
@@ -2,0 +6,0 @@ |
export declare function checkIfStateIsBeingModifiedDuringView(context: IContextInfoStruct): void; | ||
export declare function transaction<T>(action: () => T): T; | ||
export declare function transaction<T>(action: () => T, thisArg?: any): T; | ||
export declare function runAfterTransaction(action: () => void): void; | ||
@@ -4,0 +4,0 @@ export declare function untracked<T>(action: () => T): T; |
@@ -25,16 +25,13 @@ /** | ||
exports.checkIfStateIsBeingModifiedDuringView = checkIfStateIsBeingModifiedDuringView; | ||
function transaction(action) { | ||
function transaction(action, thisArg) { | ||
inTransaction += 1; | ||
try { | ||
return action(); | ||
return action.call(thisArg); | ||
} | ||
finally { | ||
if (--inTransaction === 0) { | ||
var length_1 = changedValues.length; | ||
for (var i = 0; i < length_1; i++) | ||
changedValues[i].markReady(true); | ||
changedValues.splice(0, length_1); | ||
if (changedValues.length) | ||
throw new Error("[mobservable] Illegal State, please file a bug report"); | ||
var actions = afterTransactionItems.splice(0, afterTransactionItems.length); | ||
var values = changedValues.splice(0); | ||
for (var i = 0, l = values.length; i < l; i++) | ||
values[i].markReady(true); | ||
var actions = afterTransactionItems.splice(0); | ||
for (var i = 0, l = actions.length; i < l; i++) | ||
@@ -41,0 +38,0 @@ actions[i](); |
@@ -12,3 +12,3 @@ import { ViewNode } from './dnode'; | ||
protected changeEvent: SimpleEventEmitter; | ||
constructor(func: () => T, scope: Object, context: IContextInfoStruct, compareStructural: any); | ||
constructor(func: () => T, scope: Object, context: IContextInfoStruct, compareStructural: boolean); | ||
get(): T; | ||
@@ -15,0 +15,0 @@ set(x: any): void; |
{ | ||
"name": "mobservable", | ||
"version": "1.1.3", | ||
"version": "1.1.4", | ||
"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
171967
2098