diff options
| author | niv-openerp <nicolas.vanhoren@openerp.com> | 2013-08-06 15:17:46 +0200 |
|---|---|---|
| committer | niv-openerp <nicolas.vanhoren@openerp.com> | 2013-08-06 15:17:46 +0200 |
| commit | d3a2c47fb123e1534129c19aae81691717ea3da3 (patch) | |
| tree | 04d68ef38f1b9190b401d56290c5a94b3fea2c85 /addons/web/static/src/js/openerpframework.js | |
| parent | e6e5fcde1ef2e530952b91899c3fbf70a603eff6 (diff) | |
[IMP] Moved Mutex class to openerpframework.js
bzr revid: nicolas.vanhoren@openerp.com-20130806131746-l43mz6aos7eupehm
Diffstat (limited to 'addons/web/static/src/js/openerpframework.js')
| -rw-r--r-- | addons/web/static/src/js/openerpframework.js | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/addons/web/static/src/js/openerpframework.js b/addons/web/static/src/js/openerpframework.js index 531893e1b1e..5ea279d0438 100644 --- a/addons/web/static/src/js/openerpframework.js +++ b/addons/web/static/src/js/openerpframework.js @@ -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; |
