Skip to content

Commit

Permalink
feat: remove global window.templates
Browse files Browse the repository at this point in the history
  • Loading branch information
barisusakli committed Sep 7, 2020
1 parent fddeb5c commit 630bac2
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 16 deletions.
1 change: 1 addition & 0 deletions public/src/ajaxify.js
Expand Up @@ -327,6 +327,7 @@ ajaxify = window.ajaxify || {};
require(['translator', 'benchpress'], function (translator, Benchpress) {
translator.translate('[[error:no-connection]]');
Benchpress.registerLoader(ajaxify.loadTemplate);
Benchpress.setGlobal('config', config);
});
}());

Expand Down
16 changes: 0 additions & 16 deletions public/src/app.js
Expand Up @@ -15,22 +15,6 @@ app.cacheBuster = null;
var registerMessage = params.register;
var isTouchDevice = utils.isTouchDevice();

require(['benchpress'], function (Benchpress) {
Benchpress.setGlobal('config', config);
if (Object.defineProperty) {
Object.defineProperty(window, 'templates', {
configurable: true,
enumerable: true,
get: function () {
console.warn('[deprecated] Accessing benchpress (formerly known as templates.js) globally is deprecated. Use `require(["benchpress"], function (Benchpress) { ... })` instead');
return Benchpress;
},
});
} else {
window.templates = Benchpress;
}
});

app.cacheBuster = config['cache-buster'];

bootbox.setDefaults({
Expand Down

0 comments on commit 630bac2

Please sign in to comment.