GithubHelp home page GithubHelp logo

Comments (4)

berklee avatar berklee commented on July 2, 2024

There is a global callback after a timeout, but I'm guessing that's not what you want. You could always monitor nbl.q to see if all scripts have loaded, or define a callback function for every script that checks nbl.q? I'll put it on the list for the next version, thanks!

Just to be sure, how are you using NBL, perhaps I can come up with a solution in the meantime?

from nbl.

jonnyreeves avatar jonnyreeves commented on July 2, 2024

Heya, thanks for replying. I was using NBL to load our app's js libraries at runtime; however, once all libraries had finished loading I needed to execute one last chunk of code to kick the whole thing off. At first I was using a sequence similar to this:

nbl.l([ 'script1.js', 'script2.js', 'script3.js', onAllScriptsLoaded ]);

However the onAllScriptsLoaded callback was being fired after script3.js completed which lead to a race condition. What I was really looking for was a way to say "once all these scripts have finished, execute this callback", perhaps the syntax could look something like this:

nbl.l([ 'script1.js', 'script2.js', 'script3.js' ]).onAllComplete(function () { console.log('all scripts loaded!') });

I'm afraid I had to switch to LAB.js because of this missing feature, however, my first choice was NBL due to its compact size (I need to inline the code into my project's bootstrap).

from nbl.

berklee avatar berklee commented on July 2, 2024

I get it, it' a fair point. I haven't run into this issue myself, but in retrospect, I don't understand why I did not put in that feature in the first place! This is going to the top of the list, thanks. Would you like me to contact you when I've fixed this?

from nbl.

jonnyreeves avatar jonnyreeves commented on July 2, 2024

Yes please; although if I get some free time I will have a stab at writing the code in a fork :)

Thanks for your hard work on this library and your swift replies.
Jonny.

from nbl.

Related Issues (6)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.