Commit 1d41abc9 authored by Romain Courteaud's avatar Romain Courteaud

erp_xhtml_style/erp5_web_renderjs_ui: update rsvp

parent 4975d150
...@@ -48,14 +48,14 @@ define("rsvp/all", ...@@ -48,14 +48,14 @@ define("rsvp/all",
throw new TypeError('You must pass an array to all.'); throw new TypeError('You must pass an array to all.');
} }
function canceller() { function canceller(msg) {
var promise; var promise;
for (var i = 0; i < promises.length; i++) { for (var i = 0; i < promises.length; i++) {
promise = promises[i]; promise = promises[i];
if (promise && typeof promise.then === 'function' && if (promise && typeof promise.then === 'function' &&
typeof promise.cancel === 'function') { typeof promise.cancel === 'function') {
promise.cancel(); promise.cancel(msg);
} }
} }
} }
...@@ -396,7 +396,7 @@ define("rsvp/hash", ...@@ -396,7 +396,7 @@ define("rsvp/hash",
function hash(promises) { function hash(promises) {
function canceller() { function canceller(msg) {
var promise, var promise,
key; key;
for (key in promises) { for (key in promises) {
...@@ -405,7 +405,7 @@ define("rsvp/hash", ...@@ -405,7 +405,7 @@ define("rsvp/hash",
if (promise && typeof promise.then === 'function' && if (promise && typeof promise.then === 'function' &&
typeof promise.cancel === 'function') { typeof promise.cancel === 'function') {
promise.cancel(); promise.cancel(msg);
} }
} }
} }
...@@ -552,21 +552,21 @@ define("rsvp/promise", ...@@ -552,21 +552,21 @@ define("rsvp/promise",
this.on('error', onerror); this.on('error', onerror);
this.cancel = function () { this.cancel = function (msg) {
// For now, simply reject the promise and does not propagate the cancel // For now, simply reject the promise and does not propagate the cancel
// to parent or children // to parent or children
if (resolved) { return; } if (resolved) { return; }
promise.isCancelled = true; promise.isCancelled = true;
if (canceller !== undefined) { if (canceller !== undefined) {
try { try {
canceller(); canceller(msg);
} catch (e) { } catch (e) {
rejectPromise(e); rejectPromise(e);
return; return;
} }
} }
// Trigger cancel? // Trigger cancel?
rejectPromise(new CancellationError()); rejectPromise(new CancellationError(msg));
}; };
try { try {
...@@ -629,8 +629,8 @@ define("rsvp/promise", ...@@ -629,8 +629,8 @@ define("rsvp/promise",
this.off('error', onerror); this.off('error', onerror);
var thenPromise = new this.constructor(function() {}, var thenPromise = new this.constructor(function() {},
function () { function (msg) {
thenPromise.trigger('promise:cancelled', {}); thenPromise.trigger('promise:cancelled', { msg: msg});
}); });
if (this.isFulfilled) { if (this.isFulfilled) {
...@@ -690,7 +690,7 @@ define("rsvp/promise", ...@@ -690,7 +690,7 @@ define("rsvp/promise",
if (isFunction(then)) { if (isFunction(then)) {
promise.on('promise:cancelled', function(event) { promise.on('promise:cancelled', function(event) {
if (isFunction(value.cancel)) { if (isFunction(value.cancel)) {
value.cancel(); value.cancel(event.msg);
} }
}); });
then.call(value, function(val) { then.call(value, function(val) {
...@@ -773,9 +773,9 @@ define("rsvp/queue", ...@@ -773,9 +773,9 @@ define("rsvp/queue",
return new Queue(thenable); return new Queue(thenable);
} }
function canceller() { function canceller(msg) {
for (var i = promise_list.length; i > 0; i--) { for (var i = promise_list.length; i > 0; i--) {
promise_list[i - 1].cancel(); promise_list[i - 1].cancel(msg);
} }
} }
...@@ -818,10 +818,10 @@ define("rsvp/queue", ...@@ -818,10 +818,10 @@ define("rsvp/queue",
checkPromise(resolve(thenable)); checkPromise(resolve(thenable));
queue.cancel = function () { queue.cancel = function (msg) {
if (resolved) {return;} if (resolved) {return;}
resolved = true; resolved = true;
promise.cancel(); promise.cancel(msg);
promise.fail(function (rejectedReason) { promise.fail(function (rejectedReason) {
queue.isRejected = true; queue.isRejected = true;
queue.rejectedReason = rejectedReason; queue.rejectedReason = rejectedReason;
...@@ -884,9 +884,9 @@ define("rsvp/resolve", ...@@ -884,9 +884,9 @@ define("rsvp/resolve",
} }
} }
return resolve(thenable); return resolve(thenable);
}, function () { }, function (msg) {
if ((thenable !== undefined) && (thenable.cancel !== undefined)) { if ((thenable !== undefined) && (thenable.cancel !== undefined)) {
thenable.cancel(); thenable.cancel(msg);
} }
}); });
} }
......
...@@ -234,7 +234,7 @@ ...@@ -234,7 +234,7 @@
</item> </item>
<item> <item>
<key> <string>serial</string> </key> <key> <string>serial</string> </key>
<value> <string>989.27523.29749.43383</string> </value> <value> <string>996.53961.44875.63385</string> </value>
</item> </item>
<item> <item>
<key> <string>state</string> </key> <key> <string>state</string> </key>
...@@ -252,7 +252,7 @@ ...@@ -252,7 +252,7 @@
</tuple> </tuple>
<state> <state>
<tuple> <tuple>
<float>1611827376.22</float> <float>1639486665.59</float>
<string>UTC</string> <string>UTC</string>
</tuple> </tuple>
</state> </state>
......
...@@ -48,14 +48,14 @@ define("rsvp/all", ...@@ -48,14 +48,14 @@ define("rsvp/all",
throw new TypeError('You must pass an array to all.'); throw new TypeError('You must pass an array to all.');
} }
function canceller() { function canceller(msg) {
var promise; var promise;
for (var i = 0; i < promises.length; i++) { for (var i = 0; i < promises.length; i++) {
promise = promises[i]; promise = promises[i];
if (promise && typeof promise.then === 'function' && if (promise && typeof promise.then === 'function' &&
typeof promise.cancel === 'function') { typeof promise.cancel === 'function') {
promise.cancel(); promise.cancel(msg);
} }
} }
} }
...@@ -396,7 +396,7 @@ define("rsvp/hash", ...@@ -396,7 +396,7 @@ define("rsvp/hash",
function hash(promises) { function hash(promises) {
function canceller() { function canceller(msg) {
var promise, var promise,
key; key;
for (key in promises) { for (key in promises) {
...@@ -405,7 +405,7 @@ define("rsvp/hash", ...@@ -405,7 +405,7 @@ define("rsvp/hash",
if (promise && typeof promise.then === 'function' && if (promise && typeof promise.then === 'function' &&
typeof promise.cancel === 'function') { typeof promise.cancel === 'function') {
promise.cancel(); promise.cancel(msg);
} }
} }
} }
...@@ -552,21 +552,21 @@ define("rsvp/promise", ...@@ -552,21 +552,21 @@ define("rsvp/promise",
this.on('error', onerror); this.on('error', onerror);
this.cancel = function () { this.cancel = function (msg) {
// For now, simply reject the promise and does not propagate the cancel // For now, simply reject the promise and does not propagate the cancel
// to parent or children // to parent or children
if (resolved) { return; } if (resolved) { return; }
promise.isCancelled = true; promise.isCancelled = true;
if (canceller !== undefined) { if (canceller !== undefined) {
try { try {
canceller(); canceller(msg);
} catch (e) { } catch (e) {
rejectPromise(e); rejectPromise(e);
return; return;
} }
} }
// Trigger cancel? // Trigger cancel?
rejectPromise(new CancellationError()); rejectPromise(new CancellationError(msg));
}; };
try { try {
...@@ -629,8 +629,8 @@ define("rsvp/promise", ...@@ -629,8 +629,8 @@ define("rsvp/promise",
this.off('error', onerror); this.off('error', onerror);
var thenPromise = new this.constructor(function() {}, var thenPromise = new this.constructor(function() {},
function () { function (msg) {
thenPromise.trigger('promise:cancelled', {}); thenPromise.trigger('promise:cancelled', { msg: msg});
}); });
if (this.isFulfilled) { if (this.isFulfilled) {
...@@ -690,7 +690,7 @@ define("rsvp/promise", ...@@ -690,7 +690,7 @@ define("rsvp/promise",
if (isFunction(then)) { if (isFunction(then)) {
promise.on('promise:cancelled', function(event) { promise.on('promise:cancelled', function(event) {
if (isFunction(value.cancel)) { if (isFunction(value.cancel)) {
value.cancel(); value.cancel(event.msg);
} }
}); });
then.call(value, function(val) { then.call(value, function(val) {
...@@ -773,9 +773,9 @@ define("rsvp/queue", ...@@ -773,9 +773,9 @@ define("rsvp/queue",
return new Queue(thenable); return new Queue(thenable);
} }
function canceller() { function canceller(msg) {
for (var i = promise_list.length; i > 0; i--) { for (var i = promise_list.length; i > 0; i--) {
promise_list[i - 1].cancel(); promise_list[i - 1].cancel(msg);
} }
} }
...@@ -818,10 +818,10 @@ define("rsvp/queue", ...@@ -818,10 +818,10 @@ define("rsvp/queue",
checkPromise(resolve(thenable)); checkPromise(resolve(thenable));
queue.cancel = function () { queue.cancel = function (msg) {
if (resolved) {return;} if (resolved) {return;}
resolved = true; resolved = true;
promise.cancel(); promise.cancel(msg);
promise.fail(function (rejectedReason) { promise.fail(function (rejectedReason) {
queue.isRejected = true; queue.isRejected = true;
queue.rejectedReason = rejectedReason; queue.rejectedReason = rejectedReason;
...@@ -884,9 +884,9 @@ define("rsvp/resolve", ...@@ -884,9 +884,9 @@ define("rsvp/resolve",
} }
} }
return resolve(thenable); return resolve(thenable);
}, function () { }, function (msg) {
if ((thenable !== undefined) && (thenable.cancel !== undefined)) { if ((thenable !== undefined) && (thenable.cancel !== undefined)) {
thenable.cancel(); thenable.cancel(msg);
} }
}); });
} }
......
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