Options
All
  • Public
  • Public/Protected
  • All
Menu

External module events

Introduction

The piweb.events module encapsulates the events with the associated callbacks that are triggered by the PiWeb host application. The callback functions serve as entry points for almost everything that happens in a plot extension, like drawing and data processing.

'use strict';

import * as piweb from 'piweb';

piweb.events.on("load", load);
function load( )
{
    //1. The plot is loaded, e.g. when adding the element to the report.
    piweb.logger.debug(`'load' called`)
}

piweb.events.on("dataChanged", dataChanged);
function dataChanged( )
{
    //2. The data of the databinding has been fetched.
    piweb.logger.debug(`'dataChanged' called`)
}

piweb.events.on("render", render);
function render( context: piweb.drawing.DrawingContext )
{
    //3. The plot is rendered. This happens whenever anything on the page changes.
    piweb.logger.debug(`'render' called`)
}

piweb.events.on("dataBindingChanged", dataBindingChanged);
function dataBindingChanged( )
{
    //4. The databinding was modified. Subsequently, 'dataChanged' and 'render' will be called.
    piweb.logger.debug(`'dataBindingChanged' called`)
}
see

drawing

see

data

Index

Classes

Type aliases

Variables

Functions

Type aliases

PiWebEvents

PiWebEvents: "load" | "render" | "dataBindingChanged" | "dataChanged" | "prepareRender"

An enumeration of supported events

Variables

Private context

context: EventContext = new EventContext()

Functions

Private emit

  • Parameters

    Returns boolean

on

  • Call this function to specify a callback for a specific event.

    Parameters

    • name: PiWebEvents

      The name of the event.

    • callback: Function

      The callback function.

    Returns void

Generated using TypeDoc