Skip to main content
Deno 2 is finally here 🎉️
Learn more
Module

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

Package publishing for deno.land/x/polkadot
Go to Latest
method ApiPromise.prototype.combineLatest
import { ApiPromise } from "https://deno.land/x/polkadot@0.2.27/api/index.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