Hey.
No, there is no such event in nodejs. But there are libraries that offer such
functionality, as far as I am aware. But, I would suggest something like this.
var myModule = require(...);
function initialize() {
// put some code here
}
(function(){
initialize();
// do stuff here.
})();
I saw this sort of structure being used in the web as well as in nodejs. From
what I know about javascript itself: the function expression is evualted, and
then executed immediately. Since its after your init function, it should be ran
just then, when your code is set up.
But dont take my word for the gold; I could be all wrong too. :) But its a
point to start at, I bet.
Kind regards, Ingwie.
--
"Yo Dawg, I heard you like C++, so I added C++ to your build system, so you
have to compile before you compile." -StackOverflow, Matt Joiner (
http://stackoverflow.com/a/5025525/2423150 )
Am 18.05.2014 um 23:20 schrieb Michael DeMond <[email protected]>:
> Hello Community,
>
> Total Node newb here. :) I just started a few weeks ago and have been
> learning it. I am curious if there is an equivalent to a window.onload event
> handler in NodeJS. Essentially, I am looking to execute a delegate when all
> of the code in my NodeJS application has loaded.
>
> Thank you for any assistance you can lend,
> Michael
>
> --
> Job board: http://jobs.nodejs.org/
> New group rules:
> https://gist.github.com/othiym23/9886289#file-moderation-policy-md
> Old group rules:
> https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
> ---
> You received this message because you are subscribed to the Google Groups
> "nodejs" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To post to this group, send email to [email protected].
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/nodejs/d3f86cea-2079-4c89-9a46-bba931f2850a%40googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
--
Job board: http://jobs.nodejs.org/
New group rules:
https://gist.github.com/othiym23/9886289#file-moderation-policy-md
Old group rules:
https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
---
You received this message because you are subscribed to the Google Groups
"nodejs" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/nodejs/FE868BD8-3D1C-4E7A-906B-B67D66CE1D1B%40googlemail.com.
For more options, visit https://groups.google.com/d/optout.