Created
April 19, 2012 12:28
-
-
Save tristanls/2420703 to your computer and use it in GitHub Desktop.
agility-inject multiple files example
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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' ); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 } ); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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