Rx.SingleAssignmentDisposable

Represents a disposable resource which only allows a single assignment of its underlying disposable resource. If an underlying disposable resource has already been set, future attempts to set the underlying disposable resource will throw an Error.

Usage ##

The follow example shows the basic usage of an Rx.SingleAssignmentDisposable.

var singleDisposable = new Rx.SingleAssignmentDisposable();

var disposable = Rx.Disposable.create(() => console.log('disposed'));

singleDisposable.setDisposable(disposable);

singleDisposable.dispose();
// => disposed

Location

  • rx.js

SingleAssignmentDisposable Constructor ##

SingleAssignmentDisposable Instance Methods ##

SingleAssignmentDisposable Instance Properties ##

SingleAssignmentDisposable Constructor ##

Rx.SingleAssignmentDisposable()

#

Initializes a new instance of the Rx.SingleAssignmentDisposable class.

Example

Location

  • rx.js

SingleAssignmentDisposable Instance Methods ##

Rx.SingleAssignmentDisposable.prototype.dispose()

#

Disposes the underlying disposable.

Example

Location

  • rx.js

Rx.SingleAssignmentDisposable.prototype.getDisposable()

#

Gets the underlying disposable. After disposal, the result of getting this method is undefined.

Returns

(Disposable): The underlying disposable.

Example

Location

  • rx.js

Rx.SingleAssignmentDisposable.prototype.setDisposable(value)

#

Sets the underlying disposable.

Arguments

  1. value (Disposable): The new underlying disposable.

Example

Location

  • rx.js

SingleAssignmentDisposable Instance Properties ##

isDisposed

#

Gets a value that indicates whether the object is disposed.

Example

Location

  • rx.js

Last updated

Was this helpful?