Created
February 21, 2012 21:38
-
-
Save gigafied/1879137 to your computer and use it in GitHub Desktop.
Minion - Formats
This file contains hidden or 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
minion.define("example.module", { | |
require : [ | |
"f00.module.ModuleA", | |
"f00.module.ModuleB" | |
], | |
SomeModule : minion.extend("f00.module.BaseModule", { | |
init : function () { | |
this.__super(); | |
this.moduleInstanceA = new this.__imports.ModuleA(); | |
this.moduleInstanceB = new this.__imports.ModuleB(); | |
} | |
}) | |
}); |
This file contains hidden or 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
minion.require( | |
[ | |
"f00.module.ModuleA", | |
"f00.module.ModuleB" | |
], | |
function (ModuleA, ModuleB) { | |
minion.define("example.module", { | |
SomeModule : minion.extend("f00.module.BaseModule", { | |
init : function () { | |
this.sup(); | |
this.moduleInstanceA = new ModuleA(); | |
this.moduleInstanceB = new ModuleB(); | |
} | |
}) | |
}); | |
} | |
); |
This file contains hidden or 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
minion.require( | |
[ | |
"f00.module.BaseModule", | |
"f00.module.ModuleA", | |
"f00.module.ModuleB" | |
], | |
function (BaseModule, ModuleA, ModuleB) { | |
minion.define("example.module", { | |
SomeModule : BaseModule.extend({ | |
init : function () { | |
this.sup(); | |
this.moduleInstanceA = new ModuleA(); | |
this.moduleInstanceB = new ModuleB(); | |
} | |
}) | |
}); | |
}); |
This file contains hidden or 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
define( | |
"example/module/SomeModule", | |
[ | |
"f00/module/BaseModule", | |
"f00/module/ModuleA", | |
"f00/module/ModuleB" | |
], | |
function (BaseModule, ModuleA, ModuleB) { | |
return BaseModule.extend({ | |
init : function () { | |
this.sup(); | |
this.moduleInstanceA = new ModuleA(); | |
this.moduleInstanceB = new ModuleB(); | |
} | |
}); | |
} | |
); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
current.js
is the currently supported syntax for a MinonJS Object,new1.js
andnew2.js
are both supported formats in MinionJS 2.x, the main difference between the two is thatnew1.js
usesminion.extend("f00.module.BaseModule")
whereasnew2.js
specifiesBaseModule
as a requirement, and then callsBaseModule.extend({})
;Also included is
require.js
which is an example of how we would do it using RequireJS. I actually like this approach for a number of reasons, though it does have a few shortcomings.Please comment on which approach you prefer, then list any complaints, suggestions or comments you have regarding any of the approaches.