refactor: get rid of template500Function

This commit is contained in:
Barış Soner Uşaklı
2022-02-22 19:08:12 -05:00
parent 1523d0cc50
commit 315566db6f

View File

@@ -425,12 +425,7 @@ ajaxify.widgets = { render: render };
});
};
let template500Function = null;
ajaxify.loadTemplate = function (template, callback) {
if (template === '500' && template500Function) {
return callback(template500Function);
}
$.ajax({
url: `${config.asset_base_url}/templates/${template}.js`,
dataType: 'text',
@@ -458,9 +453,7 @@ ajaxify.widgets = { render: render };
translator.translate(`[[global:reconnecting-message, ${config.siteTitle}]]`);
Benchpress.registerLoader(ajaxify.loadTemplate);
Benchpress.setGlobal('config', config);
ajaxify.loadTemplate('500', function (renderFunction) {
template500Function = renderFunction;
});
Benchpress.render('500', {}); // loads and caches the 500.tpl
});
}());