support asynchronous require #7

Open
millermedeiros opened this Issue Nov 21, 2012 · 0 comments

Comments

Projects
None yet
1 participant
Owner

millermedeiros commented Nov 21, 2012

maybe do some basic "shim" that loads the module and call a callback on the process.nextTick:

function __asyncRequire(deps, cb){
   process.nextTick( function(){
     cb.apply(this, deps.map(require));
   } );
}

easy to implement and should work for most cases.

PS: maybe we don't even need to check for name collisions, __asyncRequire shouldn't be that common (YAGNI).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment