Skip to content

How is loadScripts supposed to work with loadOrder and files #2

@no1melman

Description

@no1melman

The below snippet outlines the loadScripts function.

loadScript: function () {
var metadata = this.metadata,
files = metadata && metadata.files,
manifest = Ext.manifest,
loadOrder = manifest && manifest.loadOrder,
paths = [],
i;
// TODO: Deal with entries in the js array on package.json
if (files && loadOrder) {
for (i = 0; i < files.length; i++) {
paths.push(loadOrder[files[i]].path);
}
this.load(paths);
}
else if (metadata && !metadata.included) {
this.load(this.jsUrl);
}
},

When it runs through the files, it will look them up in the loadOrder and then append them to a paths array:

for (i = 0; i < files.length; i++) {
paths.push(loadOrder[files[i]].path);
}
this.load(paths);

However, it appears that the load function doesn't handle urls being an array, yet clearly the loadScripts is expecting at some point to pass it one.

load: function (url) {
var me = this;
me.block();
Ext.Boot.load({
url: url,
success: function () {
me.unblock();
},
failure: function () {
// css files are optional
if (url.endsWith('.css')) {
me.unblock();
} else if (!me.error) {
// Keep the first failure only
me.error = new Error('Failed to load "' + url + '"');
me.error.url = url;
me.unblock();
}
}
});
},

So, I've manipulated this so that I have extended the manifest loadOrder with my own, and I have files on the metadata. But obviously when it goes to load the urls, it fails....

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions