Options
All
  • Public
  • Public/Protected
  • All
Menu

Defines the various events and event types that can be listened for by publisher applications. Event listeners (callbacks) can be added to the publisher instance such that applications can be notified of various Spotfire events. e.g.

// Typescript
publisher.addEventListener(PublisherEventType.ACTIVE_ROW_CHANGED, (event: ActiveRowEvent) => {
console.log('The active row changed', event);
});

// JS
publisher.addEventListener(PublisherEventType.ACTIVE_ROW_CHANGED, (event) => {
console.log('The active row changed', event);
});

// JS no NPM.
publisher.addEventListener('onActiveRowChanged', (event) => {
console.log('The active row changed', event);
});

There are a number of different event types (see PublisherEventType). Each of these have a corresponding event i.e. if you add a callback for the PublisherEventType.STATE_CHANGED event type the callback will receive a StateChangedEvent.

In some cases (e.g. ConfigurationChangedEvent or StateChangedEvent) the event object provided to the callback function will contain information about the event subtype as well as information about what changed. For example there are 3 subtypes of state changed event (see StateChangedEventType). The event subtype will be indicated on the event object by the event field.

// JS no NPM.
publisher.addEventListener('onStateChanged', (event) => {
console.log('state changed and it was ' + event.event + ' sub type');
});

The contents of the event object may vary depending on the event subtype. Where this is case, there are type defined event interfaces for each of the event subtypes e.g.

// Typescript
publisher.addEventListener(PublisherEventType.CONFIGURATION_CHANGED, (event: ConfigurationChangedEvent) => {
console.log('configuration changed');
switch (event.event) {
case ConfigurationChangedEventType.COLOR_RULES:
const e = event as ColorRulesConfigurationChangedEvent;
// The event has the coloring field in this case.
console.log(e.coloring);
break;
case ConfigurationChangedEventType.COLUMNS:
const e = event as ColumnConfigurationChangedEvent;
// The event has the renderers field in this case.
console.log(e.renderers);
break;
....
}
});

// JS no NPM.
publisher.addEventListener('onConfigurationChanged', (event) => {
console.log('configuration changed');
switch (event.event) {
case 'colorRules':
// The event has the coloring field in this case.
console.log(e.coloring);
break;
case 'columns:
// The event has the renderers field in this case.
console.log(e.renderers);
break;
....
}
});

Index

Other

PublisherEventCallback: ((event: ActiveRowEvent) => void) | ((event: ConfigurationChangedEvent) => void) | ((event: StateChangedEvent) => void) | ((event: KeyValueChangedEvent) => void) | ((event: ScriptExecutionEvent) => void) | ((event: TaskChangedEvent) => void) | ((event: MessageEvent) => void) | ((event: ProxySettingsEvent) => void) | ((event: DocConfigChangedEvent) => void) | ((event: DocStateChangedEvent) => void)

Union type for the expected callback function. See Publisher.addEventListener or Publisher.removeEventListener.

Generated using TypeDoc