-
Notifications
You must be signed in to change notification settings - Fork 21
Helpers.factoryActions()
Javi Jiménez edited this page Jun 26, 2016
·
2 revisions
A async promised function which returns the fastest action of a list:
import { factoryActions } from 'ava-ia/lib/helpers';
import { forecastYahoo, forecastMSN } from 'ava-ia/lib/actions';
return factoryActions(state, actions);
'use strict';
export default async (state, actions) => {
const promises = actions.map( (action) => action.call(null, state) );
return await Promise.race(promises);
}
Feel free to offer new features, improvements or anything you can think of. This project makes sense with your participation and experience using Ava.