Commit 38a9b387 authored by Romain Courteaud's avatar Romain Courteaud

Release version 0.14.1

onStateChanges bug fixes
parent 07d8ddc6
This diff is collapsed.
This diff is collapsed.
......@@ -1265,36 +1265,53 @@ if (typeof document.contains !== 'function') {
return this.element;
})
.declareMethod('changeState', function (state_dict) {
var key,
modified = false,
previous_cancelled = this.hasOwnProperty('__modification_dict'),
modification_dict,
var next_onStateChange = new RSVP.Queue(),
previous_onStateCHange,
context = this;
if (previous_cancelled) {
modification_dict = this.__modification_dict;
modified = true;
} else {
modification_dict = {};
this.__modification_dict = modification_dict;
}
for (key in state_dict) {
if (state_dict.hasOwnProperty(key) &&
(state_dict[key] !== this.state[key])) {
this.state[key] = state_dict[key];
modification_dict[key] = state_dict[key];
modified = true;
}
}
if (modified && this.__state_change_callback !== undefined) {
return new RSVP.Queue()
if (context.hasOwnProperty('__previous_onStateChange')) {
previous_onStateCHange = context.__previous_onStateChange;
next_onStateChange
.push(function () {
return context.__state_change_callback(modification_dict);
return previous_onStateCHange;
})
.push(function (result) {
delete context.__modification_dict;
return result;
.push(undefined, function () {
// Run callback even if previous failed
return;
});
}
context.__previous_onStateChange = next_onStateChange;
return next_onStateChange
.push(function () {
var key,
modified = false,
previous_cancelled = context.hasOwnProperty('__modification_dict'),
modification_dict;
if (previous_cancelled) {
modification_dict = context.__modification_dict;
modified = true;
} else {
modification_dict = {};
}
for (key in state_dict) {
if (state_dict.hasOwnProperty(key) &&
(state_dict[key] !== context.state[key])) {
context.state[key] = state_dict[key];
modification_dict[key] = state_dict[key];
modified = true;
}
}
if (modified && context.__state_change_callback !== undefined) {
context.__modification_dict = modification_dict;
return new RSVP.Queue()
.push(function () {
return context.__state_change_callback(modification_dict);
})
.push(function (result) {
delete context.__modification_dict;
return result;
});
}
});
});
/////////////////////////////////////////////////////////////////
......
This diff is collapsed.
{
"name": "renderjs",
"version": "0.14.0",
"version": "0.14.1",
"description": "RenderJs provides HTML5 gadgets",
"main": "dist/renderjs-latest.js",
"dependencies": {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment