$k. Script

new Script()

An element that can be added to a folder

Extends

Methods

deregister()

Deregisters the element. The id will be undefined afterwards. Equivalent to setId(undefined)

See
  • setId

eval()

Evaluates the script. Equivalent to eval(source())

Version
  • Experimental feature, might be removed at any time
Since
  • 5.4.2

id() → {string}

Returns the registered ID, or undefined if not registered.

Inherited From
Returns:
Type: 
string

module() → {object}

Returns the module exports of the script

Version
  • Experimental feature, might be removed at any time
Since
  • 5.4.2
Returns:
Type: 
object

name() → {string}

Returns the name of the script

Since
  • 5.4.2
Returns:
Type: 
string

parentFolders() → {Array.<$k.Folder>}

Returns the folders that contain this element

Returns:
Type: 
Array.<$k.Folder>

registryType() → {string}

Returns the name of the registry that contains elements of this type

Returns:
Type: 
string

setId(id, replaceScriptReferences)

Registers the element with the given ID. If the element has already been registered, then the id changes. If the id is undefined, then the element will be deregistered.

Parameters:
NameTypeDescription
idstring

The ID

replaceScriptReferencesboolean

True if ID references in scripts should be replaced. Only done when the old and the new ID is not undefined.

source() → {string}

Returns the script source code

Version
  • Experimental feature, might be removed at any time
Since
  • 5.4.2
Returns:
Type: 
string