Keyboard Molecule

Enable app to respond to key presses (keyup and keydown).

Summary
Keyboard Molecule
Preference Dialog
Properties
typestring, ( r )
pref.namestring, ( r )
pref.enableWhenstring, ( r, w )
pref.disableWhenstring, ( r, w )
pref.keysstring, ( r )
pref.isTriggerEventbool, ( r, w )
pref.eventNamestring, ( r, w )
pref.withDatastring, ( r, w )
pref.isBroadcastbool, ( r, w )
pref.targetsarray, ( r, w )
pref.scriptNamestring, ( r, w )
Functions
attach
detach
delete
clone
serialize
addKey
clearKeys

Preference Dialog

Properties

type

string, ( r )

Type of this molecule, keyboard.

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 activates this molecule.  Default is load.

pref.disableWhen

string, ( r, w )

Specifies the event that deactivates this molecule.  Default is none.

pref.keys

string, ( r )

Show the character keys this molecule responds to.  This value is base64-encoded, use addKey and clearKeys to manage keys value.

pref.isTriggerEvent

bool, ( r, w )

Specifies whether to send an event or execute a script on key press.

pref.eventName

string, ( r, w )

Specifies the custom event name that this molecule sends out when detecting the target key press.

pref.withData

string, ( r, w )

Specifies the object, variable, or array molecule that is to be sent along with the event or passed to the JavaScript function as input parameter.

pref.isBroadcast

bool, ( r, w )

Specifies whether the event is sent to all droplets in the current page or a few selected droplets in a group.

pref.targets

array, ( r, w )

Specifies a list of droplets’ names that the event is to be delivered on key press.

pref.scriptName

string, ( r, w )

Specifies JavaScript function name that is to be executed on key press.

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

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.

addKey

addKey( k );

Add character keys for this keyboard molecule to respond to.

Parameters

k(string) an ASCII character, a two letter hex representation of a character(e.g.  \xA4), a four letter hex value representing an unicode character (e.g.  \u008E), or any of these reserved characters:
\rreturn.
\nnewline.
\eescape.
\bbackspace.
\ttab.
\upup arrow.
\downdown arrow.
\leftleft arrow.
\rightright arrow.

Returns

N/A

clearKeys

clearKeys( );

Remove all character keys this keyboard molecule responds to.

Parameters

N/A

Returns

N/A

Close