Sign In

taskade

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

taskade

A future implementation in TypeScript

latest
npmnpm
Version
1.0.0
Version published
Maintainers
1
Created
Source

taskade

A Task (Future) implementation in TypeScript. Useful for managing asynchronous tasks that may fail.

A Task is different then a Promise because it is lazy, rather then eager. A Promise runs as soon as you instantiate it. A Task doesn't run until you call fork. Pure functions can return tasks (just not execute them). This means that you could, for example, return a task from a Redux reducer, if that's your thing.

install

npm install --save taskade

yarn add taskade

usage

import Task from 'taskade';

function parse(s) {
  return new Task(function(reject, resolve) {
    try {
      resolve(JSON.parse(s));
    }
    catch(e) {
      reject(e.message);
    }        
  });
}

parse('foo').fork(
  function(err) { console.error(err) },
  function(value) { console.log(value) }
);

docs

API

FAQs

Package last updated on 21 Apr 2017

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts