-
Notifications
You must be signed in to change notification settings - Fork 4
Open
Description
including plugins
- Include the plugins code in your application:
<script src="path/to/some/alchemyPlugin/somePlugin.js"></script> - Initialize the plugin in your instance of alchemy by passing in the name of one or more plugins:
conf = {
...
plugins: [ 'somePlugin', 'someOtherPlugin']
...
}
writing your own plugin
Basics:
- Your plugin script should come AFTER the main alchemy.js script is loaded.
- Your plugin should extend the Alchemy prototype with a callable, for example:
Alchemy.prototype.plugins.somePlugin = function (alchemyInstance) {
// something amazing happens and it handles all of the
// logic to get your plugin loaded and playing nicely with the core Alchemy app
}OR
Alchemy::plugins.somePlugin = (alchemyInstance) ->
# something amazing!alchemyInstance contains access to the conf (alchemyInstance.conf) as well as the API methods for that instance (alchemyInstance.get.nodes(), etc.)
Additionally, for your application, you can extend the Alchemy default configurations. If you are using lodash like we do, something like Alchemy::defaults = _.merge({}, controlDashDefaults, Alchemy::defaults). If you do add confs, you may want to write a test that makes sure none of the Alchemy.defaults are getting overwritten. Rather, that you are extending the defaults, so that the user can overwrite specific defaults for your plugin directly.
Metadata
Metadata
Assignees
Labels
No labels