fix: script failure if client-side page script does not exist

v1.18.x
Julian Lam 4 years ago
parent ca14c0e2a6
commit 7da1b43f2b

@ -320,14 +320,17 @@ ajaxify = window.ajaxify || {};
location = ''; location = '';
} }
require(['hooks', location + tpl_url], (hooks, module) => { const proceed = (hooks, module) => {
if (module && module.init) { if (module && module.init) {
module.init(); module.init();
} }
hooks.fire('static:script.init', { tpl_url }).then(ajaxify.loadExtraScripts.bind(null, tpl_url, callback)); hooks.fire('static:script.init', { tpl_url }).then(ajaxify.loadExtraScripts.bind(null, tpl_url, callback));
}, function () { };
// ignore 404 error
require(['hooks', location + tpl_url], proceed, () => {
// Module doesn't exist or didn't load, proceed without it
require(['hooks'], proceed);
}); });
}; };

Loading…
Cancel
Save