mirror of
https://github.com/NodeBB/NodeBB.git
synced 2026-01-01 21:30:30 +01:00
feat: remove global window.templates
This commit is contained in:
@@ -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);
|
||||
});
|
||||
}());
|
||||
|
||||
|
||||
@@ -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({
|
||||
|
||||
Reference in New Issue
Block a user