[IMP] Moved Mutex class to openerpframework.js
bzr revid: nicolas.vanhoren@openerp.com-20130806131746-l43mz6aos7eupehm
This commit is contained in:
parent
e6e5fcde1e
commit
d3a2c47fb1
|
@ -612,21 +612,7 @@ $.fn.openerpBounce = function() {
|
|||
};
|
||||
|
||||
/** Jquery extentions */
|
||||
$.Mutex = (function() {
|
||||
function Mutex() {
|
||||
this.def = $.Deferred().resolve();
|
||||
}
|
||||
Mutex.prototype.exec = function(action) {
|
||||
var current = this.def;
|
||||
var next = this.def = $.Deferred();
|
||||
return current.then(function() {
|
||||
return $.when(action()).always(function() {
|
||||
next.resolve();
|
||||
});
|
||||
});
|
||||
};
|
||||
return Mutex;
|
||||
})();
|
||||
$.Mutex = openerp.Mutex;
|
||||
|
||||
$.async_when = function() {
|
||||
var async = false;
|
||||
|
|
|
@ -1222,6 +1222,21 @@ openerp.qweb.default_dict = {
|
|||
'_t' : openerp._t
|
||||
};
|
||||
|
||||
openerp.Mutex = openerp.Class.extend({
|
||||
init: function() {
|
||||
this.def = $.Deferred().resolve();
|
||||
},
|
||||
exec: function(action) {
|
||||
var current = this.def;
|
||||
var next = this.def = $.Deferred();
|
||||
return current.then(function() {
|
||||
return $.when(action()).always(function() {
|
||||
next.resolve();
|
||||
});
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
openerp.declare = declare;
|
||||
|
||||
return openerp;
|
||||
|
|
Loading…
Reference in New Issue