Home Reference Source
import {Whiteboard} from '@quobis/sippojs'
public class | source

Whiteboard

Extends:

src/eventemitter.js~EventEmitter → Whiteboard

Provides access to methods for creating whiteboards. This class must not be directly instantiated. It can be obtained using session#createWhiteboard or listening to session#incommingWhiteBoard event.

Events

  • shape is emitted every time a new shape is added.
  • clear is emitted every time the other end clears every shape from the whiteboard.
  • closed is emitted when the whiteboard session has finished.

You can check EventEmitter2 documentation for additional information about adding and removing listeners for this events events.

See:

Example:

How to create a Whiteboard
session.createWhiteboard(participants).then(function(whiteboard));
    whiteboard.setArea('body');
    whiteboard.tool = 'add-line';
    whiteboard.on('closed', function() {
        board.setArea(null);
    });
    ...
    board.close();
});
How to handle incoming Whiteboards
session.on('incomingWhiteBoard', function(board) {
    board.setArea('body');
    board.on('closed', function() {
       board.setArea(null);
    });
});

Static Member Summary

Static Public Members
public static get

Gets the version of the protocol implemented.

public static get

Gets the valid values for the tool field.

Member Summary

Public Members
public get

Returns the current aspect ratio of the whiteboard

public set

Updates the aspect ratio of the whiteboard

public get

Gets the current background image shown.

public set

Sets the current background image shown.

public get

Gets the current background video shown.

public set

Sets the current background video shown.

public get

Gets the color used for the shapes.

public set

Sets the color used for the shapes.

public get

Returns the current height of the whiteboard

public get
public set
public get

Gets the identities of the remote peers attached to this Whiteboard.

public get

Gets the current tool to use on user interaction.

public set

Sets the current tool to use on user interaction.

public get

Returns the current width of the whiteboard

Method Summary

Public Methods
public

Check if last undo call can be reverted.

public

Check if last action can be reverted.

public

Removes every shape from the whiteboard

public

Closes this whiteboard session.

public

redo()

Revert last undo call.

public

setArea(selector: string | HTMLElement | null): Whiteboard

Allows to set the area that will be used as the canvas for the whiteboard.

public

undo()

Revert last change.

Static Public Members

public static get PROTOCOL: string source

Gets the version of the protocol implemented.

public static get TOOL: Array<tool> source

Gets the valid values for the tool field.

Public Members

public get aspectRatio: number source

Returns the current aspect ratio of the whiteboard

public set aspectRatio: number source

Updates the aspect ratio of the whiteboard

public get backgroundImage: backgroundImage source

Gets the current background image shown.

public set backgroundImage: backgroundImage source

Sets the current background image shown.

public get backgroundVideo: string source

Gets the current background video shown.

public set backgroundVideo: string source

Sets the current background video shown. Valid values are "local", "remote" and ""

public get color: color source

Gets the color used for the shapes.

public set color: color source

Sets the color used for the shapes.

public get height: number source

Returns the current height of the whiteboard

public get lineWidth: * source

public set lineWidth source

public get remoteParticipants: Array<String> source

Gets the identities of the remote peers attached to this Whiteboard.

public get tool: tool source

Gets the current tool to use on user interaction.

public set tool: tool source

Sets the current tool to use on user interaction.

public get width: number source

Returns the current width of the whiteboard

Public Methods

public canRedo(): boolean source

Check if last undo call can be reverted.

Return:

boolean

true if a previous undo can be reverted.

public canUndo(): boolean source

Check if last action can be reverted.

Return:

boolean

true if there are actions that can be reverted.

public clear(): undefined source

Removes every shape from the whiteboard

Return:

undefined

public close(): Whiteboard source

Closes this whiteboard session.

Return:

Whiteboard

The whiteboard object.

public redo() source

Revert last undo call.

public setArea(selector: string | HTMLElement | null): Whiteboard source

Allows to set the area that will be used as the canvas for the whiteboard.

Params:

NameTypeAttributeDescription
selector string | HTMLElement | null

Selector of the DOM element where the svg canvas will be included. It also works if the HTMLElement itself is provided.

Return:

Whiteboard

The whiteboard object.

public undo() source

Revert last change.