Tasks batcher
import { inject, container, Types, Core } from '@biorate/inversion';import { IConfig, Config } from '@biorate/config';import { IBatcher, Batcher } from '@biorate/batcher';const batcher: IBatcher = new Batcher<{ data: string }, { test: string }>();batcher.register((tasks) => { console.log(tasks); // [ // [ // { data: 'one' }, // { // resolve: [Function (anonymous)], // reject: [Function (anonymous)], // metadata: { test: 'one' } // } // ], // [ // { data: 'two' }, // { // resolve: [Function (anonymous)], // reject: [Function (anonymous)], // metadata: { test: 'two' } // } // ], // [ // { data: 'three' }, // { // resolve: [Function (anonymous)], // reject: [Function (anonymous)], // metadata: { test: 'three' } // } // ] // ]});batcher.add({ data: 'one' }, { test: 'one' });batcher.add({ data: 'two' }, { test: 'two' });batcher.add({ data: 'three' }, { test: 'three' }); Copy
import { inject, container, Types, Core } from '@biorate/inversion';import { IConfig, Config } from '@biorate/config';import { IBatcher, Batcher } from '@biorate/batcher';const batcher: IBatcher = new Batcher<{ data: string }, { test: string }>();batcher.register((tasks) => { console.log(tasks); // [ // [ // { data: 'one' }, // { // resolve: [Function (anonymous)], // reject: [Function (anonymous)], // metadata: { test: 'one' } // } // ], // [ // { data: 'two' }, // { // resolve: [Function (anonymous)], // reject: [Function (anonymous)], // metadata: { test: 'two' } // } // ], // [ // { data: 'three' }, // { // resolve: [Function (anonymous)], // reject: [Function (anonymous)], // metadata: { test: 'three' } // } // ] // ]});batcher.add({ data: 'one' }, { test: 'one' });batcher.add({ data: 'two' }, { test: 'two' });batcher.add({ data: 'three' }, { test: 'three' });
Protected
Optional
Generated using TypeDoc
Description
Tasks batcher
Features:
Example