Interface

IAssetLinkPluginHandle

IAssetLinkPluginHandle

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.

View Source assetlink-plugin-api/src/IAssetLinkPluginHandle.js, line 3

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.

View Source assetlink-plugin-api/src/IAssetLinkPluginHandle.js, line 106

# 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. com.example.farmos_asset_link.routes.v0.my_page

routeDefiner routeDefiner

A method which accepts a IAssetLinkPluginRouteHandle and defines the route

View Source assetlink-plugin-api/src/IAssetLinkPluginHandle.js, line 17

# 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. com.example.farmos_asset_link.slots.v0.my_slot

slotDefiner slotDefiner

A method which accepts a IAssetLinkPluginSlotHandle and defines the slot

View Source assetlink-plugin-api/src/IAssetLinkPluginHandle.js, line 46

# 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. com.example.farmos_asset_link.widget_decorator.v0.asset_name_with_peace_sign

widgetDecoratorDefiner widgetDecoratorDefiner

A method which accepts a IAssetLinkPluginWidgetDecoratorHandle and defines the widget decorator

View Source assetlink-plugin-api/src/IAssetLinkPluginHandle.js, line 76

# 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.

View Source assetlink-plugin-api/src/IAssetLinkPluginHandle.js, line 132

# 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

View Source assetlink-plugin-api/src/IAssetLinkPluginHandle.js, line 153