An object which is passed into the method a plugin's IAssetLinkPlugin.onLoad method.
Properties:
Name | Type | Description |
---|---|---|
thisPlugin |
IAssetLinkPlugin
|
The current plugin. For JS plugins this is just the class itself, but for .vue plugins this is the only way to access the Vue component that results from loading the .vue file. |
Methods
# definePluginIngestor(pluginIngestorDefiner)
Define a plugin ingestor for this plugin.
Usage
handle.definePluginIngestor(pluginIngestor => {
pluginIngestor.onEveryPlugin(plugin => {
// Do something with every other plugin regardless of loading order...
});
});
Parameters:
Name | Type | Description |
---|---|---|
pluginIngestorDefiner |
pluginIngestorDefiner
|
A method which accepts a IAssetLinkPluginIngestorHandle and defines the plugin ingestor. |
# defineRoute(routeName, routeDefiner)
Define a route provided by this plugin.
Usage
handle.defineRoute('com.example.farmos_asset_link.routes.v0.my_page', pageRoute => {
// See https://router.vuejs.org/guide/essentials/dynamic-matching.html for route path format
pageRoute.path("/my-page/:arg");
pageRoute.component(SomeVueComponent);
});
Parameters:
Name | Type | Description |
---|---|---|
routeName |
String
|
The name of this route. e.g. |
routeDefiner |
routeDefiner
|
A method which accepts a IAssetLinkPluginRouteHandle and defines the route |
# defineSlot(slotName, slotDefiner)
Define a slot provided by this plugin.
Usage
handle.defineSlot('com.example.farmos_asset_link.slots.v0.my_slot', pageSlot => {
pageSlot.type('page-slot');
pageSlot.showIf(context => context.pageName === 'asset-page');
pageSlot.component(SomeVueComponent);
});
Parameters:
Name | Type | Description |
---|---|---|
slotName |
String
|
The name of this slot. e.g. |
slotDefiner |
slotDefiner
|
A method which accepts a IAssetLinkPluginSlotHandle and defines the slot |
# defineWidgetDecorator(widgetDecoratorName, widgetDecoratorDefiner)
Define a widget decorator provided by this plugin.
Usage
handle.defineWidgetDecorator('com.example.farmos_asset_link.widget_decorator.v0.asset_name_with_peace_sign', widgetDecorator => {
widgetDecorator.targetWidgetName('asset-name');
widgetDecorator.appliesIf(context => context.asset.attributes.status !== 'archived');
widgetDecorator.component(handle.thisPlugin);
});
Parameters:
Name | Type | Description |
---|---|---|
widgetDecoratorName |
String
|
The name of this widget decorator. e.g. |
widgetDecoratorDefiner |
widgetDecoratorDefiner
|
A method which accepts a IAssetLinkPluginWidgetDecoratorHandle and defines the widget decorator |
# onBehalfOf(otherPlugin, attributedHandlerFn)
Define functionality on behalf of another plugin.
Usage
handle.onBehalfOf(plugin, attributedHandle => {
// Asset Link will manage the lifecycle of routes/slots/etc defined via `attributedHandle`
});
Parameters:
Name | Type | Description |
---|---|---|
otherPlugin |
IAssetLinkPlugin
|
the plugin on behalf of which this plugin will define functionality. |
attributedHandlerFn |
attributedHandlerFn
|
A method which accepts the attributed IAssetLinkPluginHandle and defines functionality on behalf of that other plugin. |
# provideLibrary(libraryName, libraryProviderFn)
Provide a plugin library
Usage
handle.provideLibrary('com.example.farmos_asset_link.libraryA', library => {
library.version('1.2.3');
library.provides(libraryA);
});
Parameters:
Name | Type | Description |
---|---|---|
libraryName |
String
|
the name of the library |
libraryProviderFn |
attributedHandlerFn
|
A method which accepts a IAssetLinkPluginLibraryProvisionHandle and defines the library. |
# recordError(errorString)
Record an error from the current plugin.
Usage
handle.recordError("The stars are out of alignment.");
Parameters:
Name | Type | Description |
---|---|---|
errorString |
String
|
the error message |
# whitelistSidebarUrlPattern(urlPattern)
Whitelist a sidebar URL pattern locally.
Usage
handle.whitelistSidebarUrlPattern(/https?:\/\/.*\/plan\/(\d+)/);
See these extension model docs for more details.
Parameters:
Name | Type | Description |
---|---|---|
urlPattern |
RegExp
|
The sidebar URL pattern to be whitelisted locally. |