Skip to main content

Class: Observable

Enhanced observable to track OTR transaction on Tangle / Build.5

Hierarchy

  • Observable<TagTrackResult>

    Observable

Properties

operator

operator: Operator<any, TagTrackResult>

Deprecated

Internal implementation detail, do not use directly. Will be made internal in v8.

Inherited from

RxjsObservable.operator


source

source: Observable<any>

Deprecated

Internal implementation detail, do not use directly. Will be made internal in v8.

Inherited from

RxjsObservable.source


create

Static create: (...args: any[]) => any

Creates a new Observable by calling the Observable constructor

Owner

Observable

Method

create

Nocollapse

Deprecated

Use new Observable() instead. Will be removed in v8.

Type declaration

▸ (...args): any

Parameters
NameType
...argsany[]
Returns

any

Inherited from

RxjsObservable.create

Methods

forEach

forEach(next): Promise<void>

Used as a NON-CANCELLABLE means of subscribing to an observable, for use with APIs that expect promises, like async/await. You cannot unsubscribe from this.

WARNING: Only use this with observables you know will complete. If the source observable does not complete, you will end up with a promise that is hung up, and potentially all of the state of an async function hanging out in memory. To avoid this situation, look into adding something like timeout, take, takeWhile, or takeUntil amongst others.

Example

import { interval, take } from 'rxjs';

const source$ = interval(1000).pipe(take(4));

async function getTotal() {
let total = 0;

await source$.forEach(value => {
total += value;
console.log('observable -> ' + value);
});

return total;
}

getTotal().then(
total => console.log('Total: ' + total)
);

// Expected:
// 'observable -> 0'
// 'observable -> 1'
// 'observable -> 2'
// 'observable -> 3'
// 'Total: 6'

Parameters

NameTypeDescription
next(value: TagTrackResult) => voida handler for each value emitted by the observable

Returns

Promise<void>

a promise that either resolves on observable completion or rejects with the handled error

Inherited from

RxjsObservable.forEach

forEach(next, promiseCtor): Promise<void>

Parameters

NameTypeDescription
next(value: TagTrackResult) => voida handler for each value emitted by the observable
promiseCtorPromiseConstructorLikea constructor function used to instantiate the Promise

Returns

Promise<void>

a promise that either resolves on observable completion or rejects with the handled error

Deprecated

Passing a Promise constructor will no longer be available in upcoming versions of RxJS. This is because it adds weight to the library, for very little benefit. If you need this functionality, it is recommended that you either polyfill Promise, or you create an adapter to convert the returned native promise to whatever promise implementation you wanted. Will be removed in v8.

Inherited from

RxjsObservable.forEach


lift

lift<R>(operator?): Observable<R>

Creates a new Observable, with this Observable instance as the source, and the passed operator defined as the new observable's operator.

Type parameters

Name
R

Parameters

NameTypeDescription
operator?Operator<TagTrackResult, R>the operator defining the operation to take on the observable

Returns

Observable<R>

a new observable with the Operator applied

Method

lift

Deprecated

Internal implementation detail, do not use directly. Will be made internal in v8. If you have implemented an operator using lift, it is recommended that you create an operator by simply returning new Observable() directly. See "Creating new operators from scratch" section here: https://rxjs.dev/guide/operators

Inherited from

RxjsObservable.lift


subscribe

subscribe(next?, error?, complete?): Subscription

Parameters

NameType
next?(value: TagTrackResult) => void
error?(error: any) => void
complete?() => void

Returns

Subscription

Deprecated

Instead of passing separate callback arguments, use an observer argument. Signatures taking separate callback arguments will be removed in v8. Details: https://rxjs.dev/deprecations/subscribe-arguments

Inherited from

RxjsObservable.subscribe


toPromise

toPromise(): Promise<TagTrackResult>

Returns

Promise<TagTrackResult>

Deprecated

Replaced with firstValueFrom and lastValueFrom. Will be removed in v8. Details: https://rxjs.dev/deprecations/to-promise

Inherited from

RxjsObservable.toPromise

toPromise(PromiseCtor): Promise<TagTrackResult>

Parameters

NameType
PromiseCtorPromiseConstructor

Returns

Promise<TagTrackResult>

Deprecated

Replaced with firstValueFrom and lastValueFrom. Will be removed in v8. Details: https://rxjs.dev/deprecations/to-promise

Inherited from

RxjsObservable.toPromise

toPromise(PromiseCtor): Promise<TagTrackResult>

Parameters

NameType
PromiseCtorPromiseConstructorLike

Returns

Promise<TagTrackResult>

Deprecated

Replaced with firstValueFrom and lastValueFrom. Will be removed in v8. Details: https://rxjs.dev/deprecations/to-promise

Inherited from

RxjsObservable.toPromise