Skip to content

Instantly share code, notes, and snippets.

@tristanls
Created April 19, 2012 12:28
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tristanls/2420703 to your computer and use it in GitHub Desktop.
Save tristanls/2420703 to your computer and use it in GitHub Desktop.
agility-inject multiple files example
var typeOneAPrototype = exports.typeOneAPrototype = $$( {
model : {},
view : {
format : '<div>obj oneA</div>'
}
}); // typeOneAPrototype
var TypeOneA = exports.TypeOneA = function ( param1 ) {
var typeOneA = $$( typeOneAProtoype );
typeOneA.model.set({
param1 : param1
});
return typeOneA
}; // TypeOneA
$$.inject( { 'typeOne' : TypeOneA }, 'default' );
var typeOneBPrototype = exports.typeOneBPrototype = $$( {
model : {},
view : {
format : '<div>obj oneB</div>'
}
}); // typeOneBPrototype
var TypeOneB = exports.TypeOneB = function ( param1 ) {
var typeOneB = $$( typeOneBProtoype );
typeOneB.model.set({
param1 : param1
});
return typeOneB
}; // TypeOneB
$$.inject( { 'typeOne' : TypeOneB } );
var typeTwoPrototype = exports.typeTwoPrototype = $$( {
model : {},
view : {
format: '<div id="container"></div>'
},
controller : {
'click &' : function () {
var objOne = this.inject( 'typeOne' )(); // notice calling the constructor function
self.append( objOne );
} // click &
} // controller
}); // typeTwoPrototype
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment