ded / script.js

Asyncronous JavaScript loader and dependency manager
MIT License
2.95k stars 341 forks source link

script js doesn't load all scripts #84

Open Duskfall opened 9 years ago

Duskfall commented 9 years ago

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']);
    });
amorey commented 9 years ago

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

Duskfall commented 9 years ago

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

juanpmarin commented 7 years ago

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

boye commented 7 years ago

@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...

Duskfall commented 7 years ago

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

boye commented 7 years ago

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