[REF] web: move Bus class to web.Bus

This commit is contained in:
Géry Debongnie
2016-06-17 13:32:37 +02:00
parent d56b35e26e
commit 2254abbde7
4 changed files with 20 additions and 10 deletions
+2 -1
View File
@@ -4,6 +4,7 @@ odoo.define('mail.chat_manager', function (require) {
var bus = require('bus.bus').bus;
var utils = require('mail.utils');
var config = require('web.config');
var Bus = require('web.Bus');
var core = require('web.core');
var data = require('web.data');
var Model = require('web.Model');
@@ -837,7 +838,7 @@ var chat_manager = {
return message.channel_ids.length === 0 && message.model === model;
});
},
bus: new core.Bus(),
bus: new Bus(),
create_channel: function (name, type) {
var method = type === "dm" ? "channel_get" : "channel_create";
+16
View File
@@ -0,0 +1,16 @@
odoo.define('web.Bus', function (require) {
"use strict";
var Class = require('web.Class');
var mixins = require('web.mixins');
/**
* Event Bus used to bind events scoped in the current instance
*/
return Class.extend(mixins.EventDispatcherMixin, {
init: function() {
mixins.EventDispatcherMixin.init.call(this, parent);
},
});
});
+1 -9
View File
@@ -1,6 +1,7 @@
odoo.define('web.core', function (require) {
"use strict";
var Bus = require('web.Bus');
var Class = require('web.Class');
var mixins = require('web.mixins');
var Registry = require('web.Registry');
@@ -13,15 +14,6 @@ var debug = $.deparam($.param.querystring()).debug !== undefined;
var _t = translation._t;
var _lt = translation._lt;
/**
* Event Bus used to bind events scoped in the current instance
*/
var Bus = Class.extend(mixins.EventDispatcherMixin, {
init: function() {
mixins.EventDispatcherMixin.init.call(this, parent);
},
});
var bus = new Bus ();
_.each('click,dblclick,keydown,keypress,keyup'.split(','), function(evtype) {
+1
View File
@@ -68,6 +68,7 @@
<script type="text/javascript" src="/web/static/src/js/framework/dom_utils.js"></script>
<script type="text/javascript" src="/web/static/src/js/framework/utils.js"></script>
<script type="text/javascript" src="/web/static/src/js/framework/qweb.js"></script>
<script type="text/javascript" src="/web/static/src/js/framework/bus.js"></script>
<script type="text/javascript" src="/web/static/src/js/framework/core.js"></script>
<script type="text/javascript" src="/web/static/src/js/framework/dialog.js"></script>
<script type="text/javascript" src="/web/static/src/js/framework/local_storage.js"></script>