Class: AddOnBase

AddOnBase(logger, gmeConfig)

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
Source:

Members

blobClient :BlobClient

Type:
Source:

branchName :string

Type:
Source:

core :Core

Type:
Source:

gmeConfig :GmeConfig

Type:
Source:

logger :GmeLogger

Type:
Source:

project :Project

Type:
Source:

updateResult :AddOnUpdateResult

Type:
Source:

Methods

addCommitMessage(msg)

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

Parameters:
Name Type Description
msg string
Source:

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 Attributes Default Description
message string

If object it must contain a message.

severity string <optional>
'info'

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

Source:

configure(configuration, callback)

Configures the AddOn

Parameters:
Name Type Description
configuration object
callback function
Source:

getDefaultQueryParams() → {object}

Returns the default values of the Query Parameters.

Source:
Returns:
Type
object

getDescription() → {string}

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

Source:
Returns:
Type
string

getName() → {string}

Readable name of this AddOn that can contain spaces.

Source:
Returns:
Type
string

getQueryParamsStructure() → {Array.<object>}

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

Source:
Returns:
Type
Array.<object>

getVersion() → {string}

Current version of this AddOn using semantic versioning.

Source:
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
Source:

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.

Source:

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
Source:

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
Source: