LUY Plugin API

Plugin API

The scripts can have one of the following forms:

  • Subscription Scripts listen for an event to happen and react to that event
      'use strict';

    api.subscribeFor('ExampleBuildingBlockType', test);

    /**
    * @param {BuildingBlockType} buildingblocktype
    * @param {ChangeEvent} event
    */
    function test(buildingblocktype, event) {
    // React on the event
    }
  • Direct Execution Scripts are executed on schedule or on manual execution
      'use strict';

    api.registerExecution(onDirectExecute);

    function onDirectExecute() {
    // Do something when the execution was triggered
    }

In any reaction script, do not use any direct statements other than api.registerExecution or api.subscribeFor. All functionality has to be placed within functions. Scripts are executed arbitrarily by the Plugin system, so direct statements in the scripts will have unintended effects.