Skip to main content
Module

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

Package publishing for deno.land/x/polkadot
Go to Latest
method api.ApiPromise.prototype.combineLatest
import { api } from "https://deno.land/x/polkadot@0.2.22/mod.ts";
const { ApiPromise } = api;

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