Script Molecule

Add a build-in Javascript editor.

Summary
Script Molecule
Preference Dialog
CommentsThe following are reserved key words which you can use to gain access to parent droplet and other molecules,
Properties
typestring, ( r )
pref.namestring, ( r )
pref.enableWhenstring, ( r, w )
scriptstring, ( r, w )
Functions
attach
detach
delete
rename
clone
serialize
apply
postMessage
start
terminate

Preference Dialog

Comments

The following are reserved key words which you can use to gain access to parent droplet and other molecules,

thisthe parent droplet of this script molecule.
methe script molecule.
me.bondthe bonding molecule, if this script molecule is part of a compound.

Properties

type

string, ( r )

Type of this molecule, script.

pref.name

string, ( r )

The scriptable name for this molecule.  This name can be set using rename function dynamically.

pref.enableWhen

string, ( r, w )

Specifies the event that triggers this script.  Default is none.

script

string, ( r, w )

Specifies the JavaScript code.

Functions

attach

attach(droplet);

Attach this molecule to the given droplet.

Parameters

droplet(object) a droplet.

Returns

N/A

detach

detach();

Remove this molecule from its droplet.

Parameters

N/A

Returns

N/A

delete

delete();

Delete this molecule.

Parameters

N/A

Returns

N/A

rename

rename(name);

Rename this molecule.

Parameters

name(string) a new name.

Returns

N/A

clone

clone();

Create a clone of this molecule.

Parameters

N/A

Returns

(object) a molecule.

serialize

serialize();

Serialize this molecule into its JSON representation.

Parameters

N/A

Returns

(string) JSON representation of a molecule.

apply

apply(params);

Execute this script with the given input parameters.

Parameters

params(object) input parameters.

Returns

(mixed) function’s return value.

postMessage

postMessage(params);

Send a message to the background thread.

Parameters

params(object) message parameters.

Returns

N/A

start

start();

If “run as thread” is true, this call starts the background thread.

Parameters

N/A

Returns

N/A

terminate

terminate();

Terminates the background thread immediately without proper cleanup.

Parameters

N/A

Returns

N/A

Close