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, {@link take}, {@link takeWhile}, or {@link takeUntil} amongst others.
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'
a handler for each value emitted by the observable
a promise that either resolves on observable completion or rejects with the handled error
a handler for each value emitted by the observable
a constructor function used to instantiate the Promise
a promise that either resolves on observable completion or rejects with the handled error
Creates a new Observable, with this Observable instance as the source, and the passed operator defined as the new observable's operator.
the operator defining the operation to take on the observable
a new observable with the Operator applied
Make a commit to update the document
Object containing the DID making (and signing) the commit
Makes this document read-only. After this has been called any future attempts to call mutation methods on the instance will throw.
Update the contents of an existing Tile document based on a JSON-patch diff from the existing contents to the desired new contents
JSON patch diff of document contents
Additional options
Update an existing Tile document.
New content to replace old content
Changes to make to the metadata. Only fields that are specified will be changed.
Additional options
Creates a Tile document.
Instance of CeramicAPI used to communicate with the Ceramic network
Genesis contents. If 'null', then no signature is required to make the genesis commit
Genesis metadata
Additional options
Create Tile document from genesis commit
Instance of CeramicAPI used to communicate with the Ceramic network
Genesis commit (first commit in document log)
Additional options
Creates a deterministic Tile document.
Instance of CeramicAPI used to communicate with the Ceramic network
Genesis metadata
Additional options
Loads a Tile document from a given StreamID
Instance of CeramicAPI used to communicate with the Ceramic network
StreamID to load. Must correspond to a TileDocument
Additional options
Create genesis commit.
Object containing the DID making (and signing) the commit
genesis content
genesis metadata
TileDocument stream implementation