Class: AddOnBase

AddOnBase


new AddOnBase(logger, gmeConfig)

BaseClass for AddOns which run on the server and act upon changes in a branch. Use the AddOnGenerator to generate a new AddOn that implements this class.

Parameters:
Name Type Description
logger GmeLogger
gmeConfig GmeConfig

Members


blobClient :BlobClient

Type:

branchName :string

Type:

core :Core

Type:

gmeConfig :GmeConfig

Type:

logger :GmeLogger

Type:

project :Project

Type:

updateResult :AddOnUpdateResult

Type:

Methods


addCommitMessage(msg)

Creats or appends commit message for the current update-cycle.

Parameters:
Name Type Description
msg string

addNotification(message)

Adds a notification to all sockets connected to the branch room. The notification will be sent after the update-callback has been invoked.

Parameters:
Name Type Description
message string | object

Message string or object containing message.

Properties
Name Type Argument Default Description
message string

If object it must contain a message.

severity string <optional>
'info'

Severity level ('success', 'info', 'warn', 'error')


configure(configuration, callback)

Configures the AddOn

Parameters:
Name Type Description
configuration object
callback function

getDefaultQueryParams()

Returns the default values of the Query Parameters.

Returns:
Type
object

getDescription()

A detailed description of this AddOn and its purpose. It can be one or more sentences.

Returns:
Type
string

getName()

Readable name of this AddOn that can contain spaces.

Returns:
Type
string

getQueryParamsStructure()

Structure of query parameters with names, descriptions, minimum, maximum values, default values and type definitions.

Returns:
Type
Array.<object>

getVersion()

Current version of this AddOn using semantic versioning.

Returns:
Type
string

initialize(rootNode, commitObj, callback)

Called once when the AddOn is started for the first time.

Parameters:
Name Type Description
rootNode object
commitObj object
callback function

query(commitHash, queryParams, callback)

Queries are typically invoked by users from a client. The AddOn is not suppose to make any changes to either the model's or the AddOn's state. (Since users can share a running instance of an AddOn).

Parameters:
Name Type Description
commitHash string

State of the invoker.

queryParams object

Values based on the 'getQueryParametersStructure'.

callback function

resolves with PluginResult.


setToken(token)

Overwrite this if you are sending requests to the webgme server. Make sure to still update the blob-clients token.

Parameters:
Name Type Description
token

update(rootNode, commitObj, callback)

This is invoked after each commit to the branch. AddOns are allowed to make changes on updates, but should not persist by themselves. The manager/monitor will persist after each AddOn has had its way (ordered by the "usedAddOn" registry in the rootNode).

Changes made by AddOns do not trigger a new update for other addOns.

Parameters:
Name Type Description
rootNode module:Core~Node
commitObj module:Storage~CommitObject
callback function