Skip to content

Custom plugin

knicos edited this page Jan 17, 2013 · 1 revision

Plugins are modular JavaScript components that can be added into the js-eden environment at any time. One possible approach is to use the include_js function to load your own plugin code from your website. The intention behind plugins is that they provide new views, agents and functions for a particular purpose. Each plugin can specify a collection of views that it supports, which when loaded get added to the list of available views.

Template Plugin

The follow code is an example template plugin. The implementation of createDialog has not been provided but this should use jQuery to construct a dialog. Any number of views can be specified. It is advisable to have only one executeFileSSI.

Eden.plugins.MyPlugin = function(context) {
    this.createDialog = function(name,mtitle) {
    }

    context.views["MyView1"] = {dialog: this.createDialog, title: "My View 1"};

    Eden.executeFileSSI("plugins/myplugin/myplugin.js-e");
}

Eden.plugins.MyPlugin.title = "My Plugin";
Eden.plugins.MyPlugin.description = "Template Plugin";
Eden.plugins.MyPlugin.author = "Anon";

Clone this wiki locally