Weave.js

Plugins

Plugins maintained by Weave.js team

Introduction

Plugins are the modular pieces that extend and enhance the functionality of Weave.js. They allow you to add behavior to the canvas: like selection, zooming, snapping, panning, keyboard shortcuts, and more, without modifying the core system.

Plugins are designed to be lightweight, composable, and easy to integrate, making it simple to build rich, interactive experiences. Whether you're enabling multi-selection, managing drag-and-drop, or integrating custom logic, Plugins are how you supercharge your canvas with reusable, context-aware features.

Weave.js includes a set of built-in plugins, but you can also create your own to tailor functionality to your specific application needs.

Plugin lifecycle

Weave.js plugin lifecycle is pretty simple:

Decoupled from the lifecycle

The following methods are called outside the lifecycle:

  • When an user wants to disable the plugin, the disable method is called.
  • When an user wants to enable the plugin, the enable method is called.

Available plugins

Weave.js team maintain a set of plugins, think of them as added functionality to build visual collaborative applications. This are the plugins:

Awareness & Presence

UX

Stage

Custom Plugins

Developers can also build their own plugins, empowering this way their applications with new features closer to the needs of their applications.

For this we provide an extension mechanism that allows to define your own plugins and use them on your application.

WeavePlugin class

In Weave.js a Plugin is a class that extends the WeavePlugin abstract class, and implements a set of methods that define the Plugin behavior.

Access the Weave instance

You can access Weave.js main instance via this.instance.

To build a plugin, create a class that extends the WeavePlugin abstract class, and implement the following methods:

getName

getName(): string

The getName method returns the name of the plugin, used as an identifier on the Weave instance. The name of the plugin must be unique among other plugins.

onInit

onInit?(): void

The onInit method is optional, and is called after the first render of the Weave instance. It's a good place to initialize the plugin state, events, etc.

onRender

onRender?(): void

The onRender method is optional, and is called on every render of the Weave instance. It's a good place to update the plugin and render it's changes.

enable

enable(): void

The enable method is called when the user wants to enable the plugin.

disable

disable(): void

The enable method is called when the user wants to disable the plugin.