Services for specific purposes

The following services are available for specific purposes in the base classes:

Geolocation

Gets the GPS coordinates of the performer, if they are available. In TaskSuite and Task, it is available via this.geolocation.

Methods:

getCurrentPosition(success, error, options)
Duplicates the navigator.geolocation.getCurrentPosition() functionality.
watchPosition(success, error, options)
Duplicates the navigator.geolocation.watchPosition() functionality.

Storage

Storing data on the client. In TaskSuite and Task, it is available via this.storage.

Methods:

setItem(key, value, expiration)
Save the value under a specific key. Parameters:
  • key
  • value Can be any type. Serialized by casting to a string.
  • expiration — Storage date (Date or number). The default value is 24 hours.
getItem(key)
Returns the value by key.
removeItem(key)
Deletes a value by key.

TaskInterface

Task interface. In TaskSuite and Task, it is available via this.taskInterface.

Methods:

showInstructionPopup()
Opens the instructions.
toggleFullscreen()
Expands the task to full screen if it is collapsed. Otherwise minimizes the task.

Hotkey

Lets you subscribe to pressed keys. In TaskSuite and Task, it is available via this.hotkey.

Method:

on(event, handler, context)
Subscribes the passed handler to a specific event. Tracks events from the event parameter. Parameters:
  • event:
    • enter — The “enter” key.
    • esc — The “escape” key.
    • arrow-left, arrow-right, arrow-up, arrow-down — Arrows.
    • key — Alphanumeric keys. Handler (the handler parameter) gets the pressed key as the first argument.
  • handler — The event handler.
  • contextthis for the handler.