Object context methods

In addition to your own entry points, the host application adds some useful functions to the JavaScript object context for each plugin instance. These methods give you access to the project's data. The functions are called through the “this” variable (= the "object context").

Available functions are:

getElementName()

Returns name of the project object which “owns” the plugin.

Example:

var elementName = this.getElementName();
// do something with 'elementName'

getUI()

Get access to the inspector UI object.

Example:

var ui = this.getUI();
ui.getChildById("videourl").stringValue = this._data.videoUrl;

getDataSheetRows(dataSheetName)

Returns rows for a data sheet.

Example:

var rows = this.getDataSheetRows("Sheet 1");
  for (var i = 0; i < rows.length; ++i) {
    var row = rows[i];
    var col1 = row["column1"];
    // do something with 'col1'
  }
}

getDataSheets()

Returns all data sheets in the project.

Example:

var sheet = this.getDataSheets()["Localization sheet"];
var firstKey = sheet[0]["key"];
// do something with 'firstKey'

getDataSlotValue(dataSlotName)

Returns value of a data slot.

Example:

var value = this.getDataSlotValue("slot 1");
// do something with 'value'

getDataSlots()

Returns all data slots in the project.

Example:

var value = this.getDataSlots()["slot 1"];
// do something with 'value'

loadImage(path/image)

Deprecated. Use Plugin.loadImage() function instead (described in Utility classes under Plugin).

getComponentPreviewImage(compName)

Only in React Studio.

Returns a preview image for the component named compName.

getDataSheetOptions([sheetName])

For Web Service plugins.

sheetName is optional, without it will return the first data sheet it founds using the Web Service.

The data sheet options object contains the following fields:

query, path, requestedKeyPath, preferredImageWidth, dataSheetName, runtimeLocalPersistenceEnabled

Example:

var options = this.getDataSheetOptions();
var dataSheetAccess = exporter.valueAccessForDataSheetByName(options.dataSheetName);
// do something with 'dataSheetAccess'

getNodeUtils()

TODO

showMessage(title, [message])

TODO

getProjectInfo()

TODO