Interface: Timer

Oracle® JavaScript Extension Toolkit (JET)
5.0.0

E90577-01

QuickNav

Timer

Version:
  • 5.0.0
Module:
  • ojcore
A Timer encapsulates a Promise associated with a deferred function execution and the ability to cancel the timer before timeout.

Methods

clear() → {void}

Clears the timer and resolves the Promise. If the normal timeout hasn't yet expired, the value passed to the Promise callbacks will be boolean(false). If the timeout has already expired, this function will do nothing, and all of its Promise callbacks will receive boolean(true).
Returns:
Type
void

getPromise() → {Promise.<boolean>}

Get the Promise assocaited with this timer. Promise callbacks will be passed a single boolean value indicating if the timer's timeout expired normally (without being canceled/cleared). If the timer is left to expire after its configured timeout has been exceeded, then it will pass boolean(true) to the callbacks. If the timer's #clear method is called before its configured timeout has been reached, then the callbacks will receive boolean(false).
Returns:
This timer's Promise
Type
Promise.<boolean>