Constructor
new Promise(opt_callbackopt)
A polyfill to implement Promises, primarily for IE. Only partially supports thenables, but otherwise passes the A+ conformance tests. Note that Promise.all() and Promise.race() are not tested by that suite.
Parameters:
| Name | Type | Attributes | Description | 
|---|---|---|---|
| opt_callback | function(function(*), function(*))= | <optional> | 
- Source:
Members
- 
    (private, static, nullable) flushTimer_ :number
- 
    
    A timer ID to flush the queue.Type:- number
 - Source:
 
- 
    (private, static, non-null) q_ :Array.<function()>
- 
    
    A queue of callbacks to be invoked ASAP in the next frame.Type:- Array.<function()>
 - Source:
 
- 
    (static) State :number
- 
    
    
        Type:- number
 Properties:Name Value Type Description PENDING0 number RESOLVED1 number REJECTED2 number - Source:
 
- 
    (private, non-null) catches_ :Array.<shaka.polyfill.Promise.Child>
- 
    
    
        Type:- Array.<shaka.polyfill.Promise.Child>
 - Source:
 
- 
    (private) state_ :shaka.polyfill.Promise.State
- 
    
    
        Type:- Source:
 
- 
    (private, non-null) thens_ :Array.<shaka.polyfill.Promise.Child>
- 
    
    
        Type:- Array.<shaka.polyfill.Promise.Child>
 - Source:
 
- 
    (private) value_ :*
- 
    
    
        Type:- *
 - Source:
 
Methods
- 
    
        
            
            (static) all(othersnon-null) → (non-null) {shaka.polyfill.Promise}
- 
    
    
    
    
    
        Parameters:Name Type Description othersArray.<!shaka.polyfill.Promise> - Source:
 Returns:
- 
    
        
            
            (private, static) clearImmediate_(id)
- 
    
    
    
    
    
        Parameters:Name Type Description idnumber Clear a scheduled callback. Bound in shaka.polyfill.Promise.install() to a specific implementation. - Source:
 
- 
    
        
            
            (private, static) flush_()
- 
    
    Flush the queue of callbacks.- Source:
 
- 
    
        
            
            (private, static) handleThenable_(thenablenon-null, then, childnon-null)
- 
    
    
    
    
    
        Parameters:Name Type Description thenableObject thenFunction childshaka.polyfill.Promise - Source:
 
- 
    
        
            
            (static) install()
- 
    
    Install the polyfill if needed.- Source:
 
- 
    
        
            
            (static) race(othersnon-null) → (non-null) {shaka.polyfill.Promise}
- 
    
    
    
    
    
        Parameters:Name Type Description othersArray.<!shaka.polyfill.Promise> - Source:
 Returns:
- 
    
        
            
            (static) reject(reason) → (non-null) {shaka.polyfill.Promise}
- 
    
    
    
    
    
        Parameters:Name Type Description reason* - Source:
 Returns:
- 
    
        
            
            (static) resolve(value) → (non-null) {shaka.polyfill.Promise}
- 
    
    
    
    
    
        Parameters:Name Type Description value* - Source:
 Returns:
- 
    
        
            
            (private, static) setImmediate_(callback) → {number}
- 
    
    
    
    
    
        Parameters:Name Type Description callbackfunction() - Source:
 Returns:Schedule a callback as soon as possible. Bound in shaka.polyfill.Promise.install() to a specific implementation.- Type
- number
 
- 
    
        
            
            catch(callback) → (non-null) {shaka.polyfill.Promise}
- 
    
    
    
    
    
        Parameters:Name Type Description callbackfunction(*) - Source:
 Returns:
- 
    
        
            
            (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 childshaka.polyfill.Promise callbackfunction(*) | undefined - Source:
 
- 
    
        
            
            then(opt_successCallbackopt, opt_failCallbackopt) → (non-null) {shaka.polyfill.Promise}
- 
    
    
    
    
    
        Parameters:Name Type Attributes Description opt_successCallbackfunction(*)= <optional> 
 opt_failCallbackfunction(*)= <optional> 
 - Source:
 Returns:
Type Definitions
- 
    ChildA child promise, used for chaining. 
- 
    
    Only exists in the context of a then or catch chain.Type:- {promise: !shaka.polyfill.Promise, callback: (function(*)|undefined)}
 Properties:Name Type Description promiseshaka.polyfill.Promise The child promise. callbackfunction(*) | undefined The then or catch callback to be invoked as part of this chain. - Source: