« first day (313 days earlier)      last day (4653 days later) » 

Tom
11:10 PM
@Raynos I found a mayor issue with browserify
 
@Tom yes?
 
Tom
@Raynos this is not possible:
gist: 1172276, 2011-08-25 23:10:49Z
var routines = [
        'test'
    ];

for (var i = 0, il = routines.length; i < il; i++) {
    require(routines[i]);
}
 
Why not? :(
Oh it only does hard coded require("test") references?
OUCH
 
Tom
@Raynos yes. :[
 
Then you have to do the bootstrapping on the server & client
on the server you construct the require array to pass to browserify
 
Tom
11:13 PM
@Raynos I have no idea how to implement my bootstrapping now. How do I make it load all client side routines?
You mean a chain of require calls with hardcoded strings?
 
That could work
I was thinking more an array of files
to pass to require
pass to browserify
 
Tom
@Raynos that is exactly what I did above.. that's not possible
 
I mean pass an array to the browserify middleware
 
Tom
@Raynos what browserify middleware?
@Raynos ah I can simply pass the array to b.require
nice!
 
Yes that
 
Tom
11:19 PM
@Raynos hmm, the question is how I make sure bootstrap is detected before all other routines
and how I detect when booting is ready (when all routines have been loaded)
 
does it matter?
Just make bootstrap first in the array?
or make bootstrap the entrypoint
and build all the files bootstrap needs to require into the b.require array
 
Tom
@Raynos right, but those submodules need to do mediator.on('boot.ready', function() { });
so boot.ready has to be emitted when all modules have been loaded
 
Good luck o/
I cant think
 
Tom
@Raynos doh
@Raynos looks like your browserify suggestion aint that great after all ;)
 
It is.
I just cant think
Browserify empowers code re-use
 
Tom
11:31 PM
@Raynos well how would you detect when all those submodules have been loaded?
 
"loaded"
what do you mean
browserify packages all modules
 
Tom
required
 
well you require them in order
 
Tom
I know, that's not what I mean
 
require blocks
Once all your require calls are done everything is ready
 
Tom
11:32 PM
@Raynos yeah but I need it to require each file in the routines folder
true.
The problem is that I cannot require dynamically
 
What are we talking about
Look on the server
 
Tom
@Raynos look on the server?
 
We are walking the tree to get the list of all the files
then we pass a pointer to all those files to browserify
browserify goes and packages them all up (none of these files were executed)
 
Tom
Yeah, but the bootstrap needs to require those files.
 
Then on the client your bootstrap file runs.
The bootstraps calls a blocking require to all the files
 
Tom
11:35 PM
Yes, but the bootstrap does not know the stupid files
 
Oh I see
Thats a problem :P
 
Tom
@Raynos welcome to 20 minutes ago
 
Well turn your list of file pointers your passing to require into a JSON structure
then inject that JSON structure into the client somehow. hmm
socket.io
socket.io emits an event with those files
 
Tom
@Raynos again.. it cannot require dynamically
 
bootstraps listens on that socket.io event
 
Tom
11:36 PM
the argument to require has to be a string
 
Yes and your sending an array of strings down the socket.io stream
That exact same array of strings you passed to b.require on the server
 
Tom
Yea and I cannot require the array of strings.
 
you can loop over the strings and require them one by one?
 
Tom
@Raynos, impossible. it has to be a hardcoded string
 
Cant you call require more then once?
 
Tom
11:38 PM
@Raynos you can
 
No but look at the jquery example
 
Tom
if you pass an expression to require then there will be a big warning on the server side
 
browserify({ require : { jquery : 'jquery-browserify' } })
 
Tom
Expressions in require() statements:
    require(routines[i])
 
Here your telling browserify that the name jquery is that file pointer
Then you just pass an array of all those names you passed to browserify back to the client over socket.io
Oh I see
Damn go complain to substack
As long as that expression evaluates to a string browserify already knows about it should be cool
 
Tom
11:40 PM
yeah
 
So then we are good?
pass aliases & file pointers to b.require
then pass that map of aliases to the client side boot strap over socket.io
 
Tom
@Raynos no
I will simply make my server edit bootstrap.js every time I start it
 
Tom
and then put them in there hardcoded
 
That shit is cash!
@Tom that works too
 
Tom
11:46 PM
@Raynos I will make it look for these delimiters in boostrap.js:
/* routines-start */
/* routines-end */
 
should work
 

« first day (313 days earlier)      last day (4653 days later) »