diff options
Diffstat (limited to 'addons/web/static')
| -rw-r--r-- | addons/web/static/src/js/services/config.js | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/addons/web/static/src/js/services/config.js b/addons/web/static/src/js/services/config.js index 7ded43e291c..6c576c351bb 100644 --- a/addons/web/static/src/js/services/config.js +++ b/addons/web/static/src/js/services/config.js @@ -1,6 +1,10 @@ -odoo.define('web.config', function () { +odoo.define('web.config', function (require) { "use strict"; +const Bus = require('web.Bus'); + +const bus = new Bus(); + /** * This module contains all the (mostly) static 'environmental' information. * This is often necessary to allow the rest of the web client to properly @@ -13,6 +17,13 @@ odoo.define('web.config', function () { var config = { device: { /** + * bus to use in order to be able to handle device config related events + * - 'size_changed' : triggered when window size is + * corresponding to a new bootstrap breakpoint. The new size_class + * is provided. + */ + bus: bus, + /** * touch is a boolean, true if the device supports touch interaction * * @type Boolean @@ -99,6 +110,7 @@ function _updateSizeProps() { if (sc !== config.device.size_class) { config.device.size_class = sc; config.device.isMobile = config.device.size_class <= config.device.SIZES.SM; + config.device.bus.trigger('size_changed', config.device.size_class); } } |
