Class: shaka.util.Destroyer

Constructor

new Destroyer(callback)

Parameters:
Name Type Description
callback function A callback to destroy an object. This callback will only be called once regardless of how many times |destroy| is called.
Source:

Members

(private) destroyed_ :boolean

Type:
  • boolean
Source:

(private) onDestroy_ :function():!Promise

Type:
  • function():!Promise
Source:

(private, non-null) waitOnDestroy_ :shaka.util.PublicPromise

Type:
Source:

Methods

(async, static) with(objsnon-null, callback) → (non-null) {Promise.<T>}

A helper function to call |destroy| on |shaka.util.IDestroyable| objects in |objs| after |callback| terminates. All objects in |objs| will have |destroy| called regardless if |callback| is resolved or is rejected.
Parameters:
Name Type Description
objs Array.<!shaka.util.IDestroyable> A list of destroyable objects that should be destroyed after the callback completes.
callback function(): (!Promise.<T>|function(): T) A callback that should perform actions on the objects in |objs|. When the promise returned by this callback is resolved or is rejected, all objects in |objs| will have |destroy| called.
Source:
Returns:
Type
Promise.<T>

destroy() → (non-null) {Promise}

Request that the destroy callback be called. Will return a promise that will resolve once the callback terminates. The promise will never be rejected.
Source:
Returns:
Type
Promise

destroyed() → {boolean}

Check if |destroy| has been called. This returning |true| does not mean that the promise returned by |destroy| has resolved yet.
Source:
Returns:
Type
boolean