Extend existing functionality

Cocos Creator supports contributions between extensions.

When we are writing an extension, we can query whether the existing functions in the editor provide the function of receiving external contributions.

If the function provides contributions function, use these functions when writing extensions.

Contribution data definition

In package.json the contribution field can be defined.

  1. {
  2. "name": "hello-world",
  3. "contributions": {}
  4. }

contributions definition:

  1. interface contributions {
  2. [name: string]: any;
  3. }

The name is the name of the function or extension, and the value is of any type, which is defined by the author of the name function (extension).

At this stage, only contributions to the internal functions of the editor are opened. In the future, we will provide the ability to use contributions between extensions.