Skip to end of metadata
Go to start of metadata

The Page Extensions SPI is not yet available for public use, we discourage to use it yet

Page extensions mechanism provides a way to easily install your JavaScript code into the page. Page extensions are used mainly in cooperation with JavaScript Interface, but they can be used independently too.

Basic Usage

Own Extensions

Extensions has to implement PageExtension interface to define:

  • name,
  • JavaScript code to be executed when the extension is installed,
  • JavaScript code returning true if the extension is already installed, false otherwise,
  • dependencies.

SPI

To provide your own extensions you can use PageExtensionProvider service containg the following method:

Registry

The second way to provide your own extension is to use PageExtensionRegistry:

The registry can be also used to check whether the given extension is available:

Installation

Each extensions is defined with its name. When you want to install the extension just ask for its installator and install it. All defined dependencies will be installed too. When the extension is detected as already installed, the installation is skipped (including installation of all dependencies).

The installator is available only for extensions already registered via SPI or registry.
When a page is reloaded, all injected JavaScript code is lost, so the extension has to be installed again.
Labels:
None
Enter labels to add to this page:
Please wait 
Looking for a label? Just start typing.