Skip to content

Commit

Permalink
fix: script failure if client-side page script does not exist
Browse files Browse the repository at this point in the history
  • Loading branch information
julianlam committed Jan 27, 2021
1 parent ca14c0e commit 7da1b43
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions public/src/ajaxify.js
Original file line number Diff line number Diff line change
Expand Up @@ -320,14 +320,17 @@ ajaxify = window.ajaxify || {};
location = '';
}

require(['hooks', location + tpl_url], (hooks, module) => {
const proceed = (hooks, module) => {
if (module && module.init) {
module.init();
}

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);
});
};

Expand Down

0 comments on commit 7da1b43

Please sign in to comment.