Skip to content

davidcallanan/unsuspended-promise

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Unsuspended Promises

Brings "unsuspended promises" to JavaScript, a wrapper around promises that allows for immediate chaining of property access and function invocation.

Installation

  • npm i unsuspended-promise or pnpm i unsuspended-promise as appropriate.

Usage

unsuspended_promise

import { unsuspended_promise } from "unsuspended-promise";

const new_fetch = unsuspended_promise(fetch);
const my_data = await new_fetch("/my_api").json().my_data;

or

import { unsuspendedPromise } from "unsuspended-promise";

const new_fetch = unsuspendedPromise(fetch);
const my_data = await new_fetch("/my_api").json().my_data;

create_unsuspended_promise

import { create_unsuspended_promise } from "unsuspended-promise";

const [promise, resolve, reject] = create_unsuspended_promise();

or

import { createUnsuspendedPromise } from "unsuspended-promise";

const [promise, resolve, reject] = createUnsuspendedPromise();

Use-cases

Read my original article on this topic.

Watch my video series on this topic.

Find more JavaScript utilities at uoe.

About

Unsuspended promises implementation in JavaScript

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published