Class: shaka.polyfill.Promise

A polyfill to implement Promises, primarily for IE. Does not support thenables, but otherwise passes the A+ conformance tests. Note that Promise.all() and Promise.race() are not tested by that suite.

Source:

Members

(static) State :number

Type:
  • number
Properties:
Name Type Description
PENDING number
RESOLVED number
REJECTED number
Source:

(private, non-null) catches_ :Array.<shaka.polyfill.Promise.Child>

Type:
Source:

(private) state_ :shaka.polyfill.Promise.State

Type:
Source:

(private, non-null) thens_ :Array.<shaka.polyfill.Promise.Child>

Type:
Source:

(private) value_ :*

Type:
  • *
Source:

Methods

(static) all(othersnon-null) → (non-null) {shaka.polyfill.Promise}

Parameters:
Name Type Description
others Array.<!shaka.polyfill.Promise>
Source:
Returns:
Type
shaka.polyfill.Promise

(static) install()

Install the polyfill if needed.
Source:

(static) race(othersnon-null) → (non-null) {shaka.polyfill.Promise}

Parameters:
Name Type Description
others Array.<!shaka.polyfill.Promise>
Source:
Returns:
Type
shaka.polyfill.Promise

(static) reject(reason) → (non-null) {shaka.polyfill.Promise}

Parameters:
Name Type Description
reason *
Source:
Returns:
Type
shaka.polyfill.Promise

(static) resolve(value) → (non-null) {shaka.polyfill.Promise}

Parameters:
Name Type Description
value *
Source:
Returns:
Type
shaka.polyfill.Promise

(private, static) soon_(callback)

Parameters:
Name Type Description
callback function() Schedule a callback as soon as possible. Bound in shaka.polyfill.Promise.install() to a specific implementation.
Source:

catch(callback) → (non-null) {shaka.polyfill.Promise}

Parameters:
Name Type Description
callback function(*)
Source:
Returns:
Type
shaka.polyfill.Promise

(private) reject_(reason)

Parameters:
Name Type Description
reason *
Source:

(private) resolve_(value)

Parameters:
Name Type Description
value *
Source:

(private) schedule_(childnon-null, callback)

Parameters:
Name Type Description
child shaka.polyfill.Promise
callback function(*) | undefined
Source:

then(opt_successCallbackopt, opt_failCallbackopt) → (non-null) {shaka.polyfill.Promise}

Parameters:
Name Type Attributes Description
opt_successCallback function(*)= <optional>
opt_failCallback function(*)= <optional>
Source:
Returns:
Type
shaka.polyfill.Promise

Type Definitions

Child

Type:
Source:

Constructor

new Promise(opt_callbackopt)

Parameters:
Name Type Attributes Description
opt_callback function(function(*), function(*))= <optional>
Source:

Members

(static) State :number

Type:
  • number
Properties:
Name Type Description
PENDING number
RESOLVED number
REJECTED number
Source:

(private, non-null) catches_ :Array.<shaka.polyfill.Promise.Child>

Type:
Source:

(private) state_ :shaka.polyfill.Promise.State

Type:
Source:

(private, non-null) thens_ :Array.<shaka.polyfill.Promise.Child>

Type:
Source:

(private) value_ :*

Type:
  • *
Source:

Methods

(static) all(othersnon-null) → (non-null) {shaka.polyfill.Promise}

Parameters:
Name Type Description
others Array.<!shaka.polyfill.Promise>
Source:
Returns:
Type
shaka.polyfill.Promise

(static) install()

Install the polyfill if needed.
Source:

(static) race(othersnon-null) → (non-null) {shaka.polyfill.Promise}

Parameters:
Name Type Description
others Array.<!shaka.polyfill.Promise>
Source:
Returns:
Type
shaka.polyfill.Promise

(static) reject(reason) → (non-null) {shaka.polyfill.Promise}

Parameters:
Name Type Description
reason *
Source:
Returns:
Type
shaka.polyfill.Promise

(static) resolve(value) → (non-null) {shaka.polyfill.Promise}

Parameters:
Name Type Description
value *
Source:
Returns:
Type
shaka.polyfill.Promise

(private, static) soon_(callback)

Parameters:
Name Type Description
callback function() Schedule a callback as soon as possible. Bound in shaka.polyfill.Promise.install() to a specific implementation.
Source:

catch(callback) → (non-null) {shaka.polyfill.Promise}

Parameters:
Name Type Description
callback function(*)
Source:
Returns:
Type
shaka.polyfill.Promise

(private) reject_(reason)

Parameters:
Name Type Description
reason *
Source:

(private) resolve_(value)

Parameters:
Name Type Description
value *
Source:

(private) schedule_(childnon-null, callback)

Parameters:
Name Type Description
child shaka.polyfill.Promise
callback function(*) | undefined
Source:

then(opt_successCallbackopt, opt_failCallbackopt) → (non-null) {shaka.polyfill.Promise}

Parameters:
Name Type Attributes Description
opt_successCallback function(*)= <optional>
opt_failCallback function(*)= <optional>
Source:
Returns:
Type
shaka.polyfill.Promise

Type Definitions

Child

Type:
Source: