Plugins

Introduction

A plugin is a self-contained piece of code that adds functionality to Blockly. Plugins can add fields, define themes, create renderers, and much more.

The target user for a plugin is a developer who finds and uses the plugin through npm.

First-party vs third-party

Plugins defined in the blockly-samples repository are first-party plugins, which means that they are supported by the Blockly team and published under the @blockly scope on npm.

Great first party plugins:

  • have obvious use cases
  • are general-purpose
  • are stable
  • are easy to use

Third party plugins are maintained and published independently. Third party plugins may be more complex, more experimental, or more targeted.

For instance, a field for setting motor speed could be used in many robotics projects. On the other hand, a field for editing a specific object defined by your database schema is better as a third party plugin.

First party criteria

First party plugins must meet these requirements:

  • Works on all major platforms, unless granted an exemption by the Blockly team.
    • Chrome, Firefox, Safari, Edge
  • Has an author who is willing to handle bugs for the first year.
  • Does not monkeypatch Blockly.
  • Has a clearly defined and documented API.
  • Does not call private or package functions from Blockly core, unless granted an exemption by the Blockly team.
    • Overriding package functions on a subclass that you define is allowed.
    • If you want an exemption, ask us in an issue on blockly-samples.
  • Has tests.

Finding plugins

  • On GitHub Pages Explore live demos of first-party plugins.
  • On npm Search for @blockly to see a list of the plugins published by the Blockly team.
  • On GitHub Look at the plugins directory in the blockly-samples repository. Each plugin has a README that describes its behaviour and intended use.