script.js icon indicating copy to clipboard operation
script.js copied to clipboard

script js doesn't load all scripts

Open Duskfall opened this issue 10 years ago • 6 comments

I have an array of scripts that load together (order is insignificant) and script js fails to load them. For example test4 and test 7 don't load, making the app not to bootstrap at all. This happens at random times in chrome and every time i open an incognito window and try the url

   $script.ready('dependencies', function () {

    console.info("loaded dependencies");

    $script([
            'Libs/test1',
            'Libs/test2',
            'Libs/test3',
            'Libs/test4',
            'Libs/test5',
            'Libs/test6',
            'Libs/Subfolder/test7'
    ], function () {

        console.info("bootstraping app");
        angular.bootstrap(document, ['nlgApp']);
    });

Duskfall avatar Aug 06 '15 08:08 Duskfall

I believe that script.js doesn't handle error callbacks because they're not supported in older browsers (LTE IE8). Here's the relevant code: https://github.com/ded/script.js/blob/master/src/script.js#L65-L77

In case it helps, I wrote a script.js-compatible library that handles error callbacks but it only works in modern browsers (IE9+): https://github.com/muicss/loadjs

amorey avatar Aug 06 '15 13:08 amorey

I only need from IE10+ so it will be optimal! Thanks i'll try it :)

Duskfall avatar Aug 06 '15 14:08 Duskfall

I have the same error, @Duskfall loadjs works for your case ?

juanmarin-co avatar Dec 13 '16 19:12 juanmarin-co

@Duskfall have you tried $script.order already? See: https://github.com/ded/script.js/blob/master/src/script.js#L86

PS as far as I know it's not documented anywhere...

boye avatar Dec 13 '16 20:12 boye

I have moved away from scriptjs long ago, now using SystemJS module loading system to get ready for ES2016 with Typescript.

Duskfall avatar Dec 13 '16 22:12 Duskfall

Ah, i didn't noticed the date of this issue :') that figures

boye avatar Dec 14 '16 14:12 boye