Key Listener (ref)

(part of package 'Key Listener')

You can access it in code via: plugins.keyListener

Properties

API

addKeyListener(callbackKey,callback,clearCB,delay,regexPattern,regexReplacement)

Registers the listener on the components which have the "keylistener" attribute with the given callbackKey value, to call the given callback when a key is pressed.

Example:

plugins.keyListener.addKeyListener('test', onKey)

Parameters:

  • {String} callbackKey The key for which the listener will be added. This key has to match value of "keylistener" attribute in component.

  • {Function} callback The callback function to be called when a key is pressed.

  • {Boolean} [clearCB] If true a removeKeyListener will be called for this key before adding the new one. Default value is false.

  • {Number} [delay] Number of milliseconds to wait before callback method is called. Default value is 1000.

  • {String} [regexPattern] Javascript regular expression string to modify current value of the component.

  • {String} [regexReplacement] The value that is used to replace the regular expression with in the current value of the component.


removeKeyListener(callbackKey)

Removes the listener associated to the given callback key. Returns true if the listener was removed.

Example:

plugins.keyListener.removeKeyListener('test')

Parameters:

  • {String} callbackKey The key listener to remove.

Returns: Boolean Succes of removal


Types

callback

scripting type: CustomType<keyListener.callback>


Last updated

Was this helpful?