summaryrefslogtreecommitdiff
path: root/addons/web_editor/static/src/js
diff options
context:
space:
mode:
authorChristophe Matthieu <chm@odoo.com>2017-08-31 14:39:52 +0200
committerChristophe Matthieu <chm@odoo.com>2017-08-31 16:26:11 +0200
commit95c2bd33a2e4bc5995b77c64c961e97db809e7f2 (patch)
tree27c6d4104ae973ad293f0b8e5742f231f8362ff1 /addons/web_editor/static/src/js
parent6f60a9a1792f4390c883bc1dff5f595c84183e12 (diff)
[IMP] web: lazy load nvd3, ace and fullCalendar lib to reduce asset size
Diffstat (limited to 'addons/web_editor/static/src/js')
-rw-r--r--addons/web_editor/static/src/js/widgets/ace.js21
1 files changed, 13 insertions, 8 deletions
diff --git a/addons/web_editor/static/src/js/widgets/ace.js b/addons/web_editor/static/src/js/widgets/ace.js
index 03c767328d1..3ba6d29b2b8 100644
--- a/addons/web_editor/static/src/js/widgets/ace.js
+++ b/addons/web_editor/static/src/js/widgets/ace.js
@@ -112,6 +112,14 @@ function formatLESS(less) {
var ViewEditor = Widget.extend({
template: 'web_editor.ace_view_editor',
xmlDependencies: ['/web_editor/static/src/xml/ace.xml'],
+ jsLibs: [
+ '/web/static/lib/ace/ace.odoo-custom.js',
+ [
+ '/web/static/lib/ace/mode-xml.js',
+ '/web/static/lib/ace/mode-less.js',
+ '/web/static/lib/ace/theme-monokai.js'
+ ]
+ ],
events: {
'click .o_ace_type_switcher_choice': '_onTypeChoice',
'change .o_res_list': '_onResChange',
@@ -170,14 +178,11 @@ var ViewEditor = Widget.extend({
* @override
*/
willStart: function () {
- var js_def = ajax.loadJS('/web/static/lib/ace/ace.odoo-custom.js').then(function () {
- return $.when(
- ajax.loadJS('/web/static/lib/ace/mode-xml.js'),
- ajax.loadJS('/web/static/lib/ace/mode-less.js'),
- ajax.loadJS('/web/static/lib/ace/theme-monokai.js')
- );
- });
- return $.when(this._super.apply(this, arguments), js_def, this._loadResources());
+ return $.when(
+ this._super.apply(this, arguments),
+ ajax.loadLibs(this),
+ this._loadResources()
+ );
},
/**
* Initializes the library and initial view once the DOM is ready. It also