Skip to content

Instantly share code, notes, and snippets.

@bgerrissen
Created May 13, 2011 22:27
Show Gist options
  • Save bgerrissen/971430 to your computer and use it in GitHub Desktop.
Save bgerrissen/971430 to your computer and use it in GitHub Desktop.
// you know
require();
define();
// next step
compose( "scopeID" , [ "extra" ], function( src , extra ){
// all options
src( "some/module" ) // a js class or object
.id( "myModule" ) // make it referencable
.args( 1 , 2 ) // constructor args
.when.domFind( ".cssExpression" ) // load and create it when this condition is met
.when.domEvent( "click" , ".cssExpression" ) // ditto
.when.browserUrl( "/path/page" ) // ditto
.set( "propName" , "some/other/moduke" ) // dependency injection
.invoke( "methodName" , "arg1" , "arg2" )
;
src( "other/module" )
.set( "prop" , "@myModule" ) // module instance we stored earlier (if conditions where met)
.when( true ) // load and create now
;
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment