JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 26
  • Score
    100M100P100Q49159F
  • License MIT

Promises running in separated threads

Package Exports

  • thread-promises

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (thread-promises) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

ThreadPromises

Promises running in separated threads

It is an early version.

Now it support only then and catch methods.

#Installing

<script src="/lib/thread-promises.min.js"></script>

Or

npm i --save thread-promises
import TPromise from "thread-promises"

Example

function delay(ms) {
  return new TPromise((resolve, reject, ms) => {
    setTimeout(() => {
      reject("error")
    }, ms)
  }, ms)
}

console.log("Starting 3 seconds reject delay")
delay(3000)
  .then(() => {
    console.log("Resolved")
  })
  .catch((data) => {
    console.log("Rejected with error: " + data)
  })