1.0.0 • Published 3 years ago

synchronize-promise v1.0.0

Weekly downloads
7
License
ISC
Repository
github
Last release
3 years ago

synchronizePromise

A ts-type friendly promise Library —— Synchronize your promise!

Install

npm install synchronize-promise

Demo

import synchronizePromise from "synchronize-promise";

function test() {
  return new Promise((resolve) =>
    setTimeout(() => resolve("ConcurrentPromise"), 3000)
  );
}

const sTest = synchronizePromise(test);

// you will see the 「ConcurrentPromise」 every three seconds
sTest().then((ret) => console.log(ret));
sTest().then((ret) => console.log(ret));
sTest().then((ret) => console.log(ret));

Related

A ts-type friendly promise Library —— Concurrent your promise!