Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

Version 1 Current »

Phone API Reference - Core - exports

exports

Object used to provide functions, variables, and properties for use by another script. Use require in another script to obtain the exports in the current script.

Exports will not work if you set exports = to an object (e.g., {"key" : "value" }). You must set properties of the exports object as can be seen in the example. 

Require Extended Library: 

exports.test = "test";

Examples

js example file with exports

var example2 = {};
example2.init = function () {
    this.status = 'Status set by example2.init()';
};
example2.getStatus = function () {
    return this.status;
};
example2.setStatus = function (param) {
    this.status = param;
};
  
example2.init();
exports.getStatus = example2.getStatus.bind(example2);
exports.setStatus = example2.setStatus.bind(example2);

  • No labels