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. But it works.
Installing
<script src="/lib/thread-promises.min.js"></script>
Or
npm i --save thread-promises
import TPromise from "thread-promises"
Examples
Expample of making blocking job on main thread and on TPromise's thread
Usage
new TPromise((resolve, reject) => {
console.log("Look ma, I am multithread JavaScript!")
})
For additional properties put them after executor function (like in setTimeout):
new TPromise((resolve, reject, some, additional, properties) => {
console.log("I have no access to my old lexical environment, but I can use props")
console.log(some, additional, properties)
}, some, additional, properties)