Plugins

Plugins represents different extension points in Scifeon. Each plugin type serves a specific purpose, and have different capabilities. Explore the different plugins, and let us know if you need a new extension point. We will love to help.
Plugin architecture
Plugins are automatically added to Scifeon when the containing App is loaded. In general, plugins are defined in the plugins
array in the contributions.json
file. For each plugin type, it is described what needs to go in the plugins
section, but the following holds for all plugins:
{
"id": "id", // required
"src": "path", // required
"types": ["type"], // required
"name": "name", // optional
"description": "description"// optional
}
Plugins are added to the PluginManager
, which in turn calls the static isMatch
method with a Context
-object whenever a page, panel or module queries for plugins. The Context
-object typically holds information about the current entity and associated entities.
Plugin life-cycle
As Scifeon is built on the Aurelia framework, the same life-cycle methods that are used in Aurelia, are also used Scifeon plugins.
Example: PagePlugin
The following simple PagePlugin illustrates the complete life-cycle of a plugin, from initialization to navigating away from the page again.
import { PagePlugin } from "scifeon/plugins";
export class LifeCyclePage implements PagePlugin {
constructor() {
console.log("1: an instance of the plugin is created");
}
init(context) {
console.log("2: init is called with the context");
}
activate() {
console.log("3: activate is called by Aurelia");
}
created(owningView, myView) {
console.log("4: created is called by Aurelia");
}
bind(bindingContext, overrideContext) {
console.log("5: bind is called by Aurelia");
}
attached() {
console.log("6: attached is called by Aurelia - the DOM is ready");
}
detached() {
console.log("7: detached is called by Aurelia");
}
unbind() {
console.log("8: unbind is called by Aurelia");
}
}
Example: DashboardPanelPlugin
Other plugins, such as a DashboardPanel have slightly different life-cycle methods:
import { DashboardPanelPlugin } from "scifeon/plugins";
export class LifeCyclePage implements DashboardPanelPlugin {
static isMatch(context) {
console.log("0: isMatch is called from the PluginManager");
return true;
}
constructor() {
console.log("1: an instance of the plugin is created");
}
init(context) {
console.log("2: init is called from the PluginManager");
}
activate() {
console.log("3: activate is called by Aurelia");
}
created(owningView, myView) {
console.log("4: created is called by Aurelia");
}
bind(bindingContext, overrideContext) {
console.log("5: bind is called by Aurelia");
}
attached() {
console.log("6: attached is called by Aurelia - the DOM is ready");
}
detached() {
console.log("7: detached is called by Aurelia");
}
unbind() {
console.log("8: unbind is called by Aurelia");
}
}
Read more about life-cycle methods at the Aurelia documentation.