Skip to content

@camera.ui/sdk / observable / Disposable

Class: Disposable

Defined in: observable/index.ts:11

Subscription handle returned by subscribe().

Call dispose() (or its alias unsubscribe()) to detach the listener and run any teardown logic registered by the producer. Disposing twice is a no-op.

Constructors

Constructor

new Disposable(teardown): Disposable

Defined in: observable/index.ts:15

Parameters

teardown

() => void

Returns

Disposable

Accessors

closed

Get Signature

get closed(): boolean

Defined in: observable/index.ts:20

Whether the subscription has already been disposed.

Returns

boolean

Methods

dispose()

dispose(): void

Defined in: observable/index.ts:33

Detach the listener and run the producer teardown. Disposing twice is a no-op.

Returns

void

Example

ts
const sub = sensor.onPropertyChanged.subscribe(handleChange);
sub.dispose();

unsubscribe()

unsubscribe(): void

Defined in: observable/index.ts:48

Alias for Disposable.dispose, for rxjs-shaped call sites.

Returns

void

Example

ts
const sub = sensor.onPropertyChanged.subscribe(handleChange);
sub.unsubscribe();