Reference Source
import {Plugin} from 'xeokit-sdk/src/viewer/Plugin.js'
public class | source

Plugin

Base class for Viewer plugin classes.

Constructor Summary

Public Constructor
public

constructor(id: string, viewer: Viewer, cfg: Object)

Creates this Plugin and installs it into the given Viewer.

Member Summary

Public Members
public

ID for this Plugin, unique within its Viewer.

public

The Viewer that contains this Plugin.

Method Summary

Public Methods
public

Destroys this Plugin and removes it from its Viewer.

public

error(msg: String)

Logs an error message to the JavaScript developer console, prefixed with the ID of this Plugin.

public

fire(event: String, value: Object)

Fires an event at this Plugin.

public

log(msg: String)

Logs a message to the JavaScript developer console, prefixed with the ID of this Plugin.

public

on(event: String, callback: Function)

Subscribes to an event fired at this Plugin.

public

warn(msg: String)

Logs a warning message to the JavaScript developer console, prefixed with the ID of this Plugin.

Public Constructors

public constructor(id: string, viewer: Viewer, cfg: Object) source

Creates this Plugin and installs it into the given Viewer.

Params:

NameTypeAttributeDescription
id string

ID for this plugin, unique among all plugins in the viewer.

viewer Viewer

The viewer.

cfg Object
  • optional

Options

Public Members

public id: string source

ID for this Plugin, unique within its Viewer.

public viewer: Viewer source

The Viewer that contains this Plugin.

Public Methods

public destroy() source

Destroys this Plugin and removes it from its Viewer.

public error(msg: String) source

Logs an error message to the JavaScript developer console, prefixed with the ID of this Plugin.

Params:

NameTypeAttributeDescription
msg String

The error message

public fire(event: String, value: Object) source

Fires an event at this Plugin.

Params:

NameTypeAttributeDescription
event String

The event type name

value Object

The event parameters

public log(msg: String) source

Logs a message to the JavaScript developer console, prefixed with the ID of this Plugin.

Params:

NameTypeAttributeDescription
msg String

The error message

public on(event: String, callback: Function) source

Subscribes to an event fired at this Plugin.

Params:

NameTypeAttributeDescription
event String

The event

callback Function

Callback fired on the event

public warn(msg: String) source

Logs a warning message to the JavaScript developer console, prefixed with the ID of this Plugin.

Params:

NameTypeAttributeDescription
msg String

The error message