1
0
mirror of https://github.com/koloml/furbooru-tagging-assistant.git synced 2025-12-24 07:12:57 +00:00

Added AMD loader initialization as separate entry, autoload everything

This commit is contained in:
2025-04-06 15:13:31 +04:00
parent 7cf2730402
commit 966100d606
3 changed files with 53 additions and 0 deletions

22
src/content/deps/amd.ts Normal file
View File

@@ -0,0 +1,22 @@
import { amdLite } from "amd-lite";
const originalDefine = amdLite.define;
amdLite.define = (name, dependencies, originalCallback) => {
return originalDefine(name, dependencies, function () {
const callbackResult = originalCallback(...arguments);
// Workaround for the entry script not returning anything causing AMD-Lite to send warning about modules not
// being loaded/not existing.
return typeof callbackResult !== 'undefined' ? callbackResult : {};
})
}
amdLite.init({
publicScope: window
});
// We don't have anything asynchronous, so it's safe to execute everything on the next frame.
requestAnimationFrame(() => {
amdLite.resolveDependencies(Object.keys(amdLite.waitingModules))
});