Module

x/polkadot/api/bundle.ts>ApiPromise#combineLatest

Package publishing for deno.land/x/polkadot
Go to Latest
method ApiPromise.prototype.combineLatest
import { ApiPromise } from "https://dotland.deno.dev/x/polkadot@0.2.38/api/bundle.ts";

Examples

const address = '5DTestUPts3kjeXSTMyerHihn1uwMfLj8vU8sqF7qYrFacT7';

// combines values from balance & nonce as it updates
api.combineLatest([
  api.rpc.chain.subscribeNewHeads,
  (cb) => api.query.system.account(address, cb)
], ([head, [balance, nonce]]) => {
  console.log(`#${head.number}: You have ${balance.free} units, with ${nonce} transactions sent`);
});

Type Parameters

optional
T extends any[] = any[]

Parameters

fns: (CombinatorFunction | [CombinatorFunction, ...any[]])[]

An array of function to combine, each in the form of (cb: (value: void)) => void

callback: CombinatorCallback<T>

A callback that will return an Array of all the values this combinator has been applied to

Returns

UnsubscribePromise