Skip to content

plugins documentation #1

@hdngr

Description

@hdngr

including plugins

  1. Include the plugins code in your application:
    <script src="path/to/some/alchemyPlugin/somePlugin.js"></script>
  2. 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:

  1. Your plugin script should come AFTER the main alchemy.js script is loaded.
  2. 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

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions