From d3a2c47fb123e1534129c19aae81691717ea3da3 Mon Sep 17 00:00:00 2001 From: niv-openerp Date: Tue, 6 Aug 2013 15:17:46 +0200 Subject: [PATCH] [IMP] Moved Mutex class to openerpframework.js bzr revid: nicolas.vanhoren@openerp.com-20130806131746-l43mz6aos7eupehm --- addons/web/static/src/js/core.js | 16 +--------------- addons/web/static/src/js/openerpframework.js | 15 +++++++++++++++ 2 files changed, 16 insertions(+), 15 deletions(-) diff --git a/addons/web/static/src/js/core.js b/addons/web/static/src/js/core.js index 6a30868e8ec..c4bd3981806 100644 --- a/addons/web/static/src/js/core.js +++ b/addons/web/static/src/js/core.js @@ -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; 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;