Last active
August 29, 2015 14:25
-
-
Save andersevenrud/c2e84548a3c0af8c7150 to your computer and use it in GitHub Desktop.
OSjs Module Example
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
// | |
// Example: src/javascript/helpers/my-module.js | |
// Add to: `src/conf/200-compile.json` | |
// Then run: `grunt dist-dev-index` to add to dist-dev build | |
// Or: `grunt core` to add to dist build | |
// | |
(function(Utils, VFS, API) { | |
///////////////////////////////////////////////////////////////////////////// | |
// MODULE API | |
///////////////////////////////////////////////////////////////////////////// | |
// Just a basic pattern to keep methods | |
var MyModule = { | |
someMethod: function() { | |
} | |
}; | |
///////////////////////////////////////////////////////////////////////////// | |
// EXPORTS | |
///////////////////////////////////////////////////////////////////////////// | |
// Available namespaces: API, VFS, Utils, Helpers, Core | |
// Helpers is what I call the generic libraries... because they "help you" | |
OSjs.Helpers.MyModule = MyModule; | |
})(OSjs.Utils, OSjs.VFS, OSjs.API); | |
// | |
// Then somewhere in your application code | |
// Just an example | |
// | |
MyApplication.prototype.something = function() { | |
OSjs.Helpers.MyModule.someMethod(); | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment