Commit 183cb362 authored by Romain Courteaud's avatar Romain Courteaud

Release version 0.12.0

parent 53cfcd0b
This diff is collapsed.
This diff is collapsed.
...@@ -1120,6 +1120,7 @@ if (typeof document.contains !== 'function') { ...@@ -1120,6 +1120,7 @@ if (typeof document.contains !== 'function') {
}; };
RenderJSGadget.setState = function (state_dict) { RenderJSGadget.setState = function (state_dict) {
var json_state = JSON.stringify(state_dict); var json_state = JSON.stringify(state_dict);
this.prototype.__json_state = json_state;
return this.ready(function () { return this.ready(function () {
this.state = JSON.parse(json_state); this.state = JSON.parse(json_state);
}); });
...@@ -1250,7 +1251,8 @@ if (typeof document.contains !== 'function') { ...@@ -1250,7 +1251,8 @@ if (typeof document.contains !== 'function') {
.declareMethod('changeState', function (state_dict) { .declareMethod('changeState', function (state_dict) {
var key, var key,
modified = false, modified = false,
modification_dict = {}; modification_dict = {},
context = this;
for (key in state_dict) { for (key in state_dict) {
if (state_dict[key] !== this.state[key]) { if (state_dict[key] !== this.state[key]) {
this.state[key] = state_dict[key]; this.state[key] = state_dict[key];
...@@ -1259,7 +1261,18 @@ if (typeof document.contains !== 'function') { ...@@ -1259,7 +1261,18 @@ if (typeof document.contains !== 'function') {
} }
} }
if (modified && this.__state_change_callback !== undefined) { if (modified && this.__state_change_callback !== undefined) {
return this.__state_change_callback(modification_dict); return new RSVP.Queue()
.push(function () {
return context.__state_change_callback(modification_dict);
})
.push(undefined, function (error) {
if (context.__json_state !== undefined) {
context.state = JSON.parse(context.__json_state);
} else {
context.state = {};
}
throw error;
});
} }
}); });
...@@ -1622,7 +1635,14 @@ if (typeof document.contains !== 'function') { ...@@ -1622,7 +1635,14 @@ if (typeof document.contains !== 'function') {
gadget_loading_klass = undefined; gadget_loading_klass = undefined;
throw e; throw e;
}); });
local_loading_klass_promise = loading_klass_promise; //gadget loading should not be interrupted
//if not, gadget's definition will not be complete
//.then will return another promise
//so loading_klass_promise can't be cancel
local_loading_klass_promise = loading_klass_promise
.then(function (gadget_instance) {
return gadget_instance;
});
queue = new RSVP.Queue() queue = new RSVP.Queue()
.push(function () { .push(function () {
......
This diff is collapsed.
{ {
"name": "renderjs", "name": "renderjs",
"version": "0.11.0", "version": "0.12.0",
"description": "RenderJs provides HTML5 gadgets", "description": "RenderJs provides HTML5 gadgets",
"main": "dist/renderjs-latest.js", "main": "dist/renderjs-latest.js",
"dependencies": { "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