define(moduleObject)
Description |
Function used to create entry point scripts and custom modules in SuiteScript 2.x. For more information, see SuiteScript 2.x Entry Point Script Creation and Deployment and SuiteScript 2.x Custom Modules. Use this If you are creating an entry point script, the define() function must return an object consisting of at least one key:value pair. Each key must be an entry point and the corresponding value must be a named entry point function. All entry points must be for the same script type. Your script can have only one entry point script and the entry point script must be only one script type. |
Returns |
Object |
Global object |
|
Since |
2015.2 |
Parameters
Parameter |
Type |
Required / Optional |
Description |
Since |
---|---|---|---|---|
|
Object |
required |
A callback function or a module object. |
2015.2 |
Syntax
The following code show sample syntax for the define(moduleobject) function signature. These code samples are not functional examples and do not provide complete list of ways this define() signature can be used.
Define a Function
// lib.js
define({
test: function ()
{
return true;
}
});
OR
// lib.js
define(function ()
{
return true
});
Define an object
// lib.js
define({
color: "black",
size: "unisize"
});
Define a Primitive Value
// lib.js
define("test");