Class: shaka.util.Destroyer

A utility class to help work with |shaka.util.IDestroyable| objects.

Constructor

new Destroyer(callback)

A utility class to help work with |shaka.util.IDestroyable| objects.

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

destroyed_ :boolean

Type:
  • boolean
Source:

onDestroy_ :function():!Promise

Type:
  • function():!Promise
Source:

Methods

destroyedError(erroropt) → {shaka.util.Error}

Parameters:
Name Type Attributes Description
error * <optional>
The inner error, if any.
Source:
Returns:
Type
shaka.util.Error

destroy() → {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

ensureNotDestroyed(erroropt)

Checks if the object is destroyed and throws an error if it is.
Parameters:
Name Type Attributes Description
error * <optional>
The inner error, if any.
Source: