1 | # Resolvable Promise
|
2 |
|
3 | A promise that is resolvable (or rejectable) after it was created.
|
4 |
|
5 | ```ts
|
6 | const promise = new ResolvablePromise()
|
7 | promise.then(x => console.log('Resolved!', x))
|
8 | promise.resolve({ foo: 'bar' })
|
9 | ```
|
10 |
|
11 | --------
|
12 |
|
13 | <p align="center"><a href="https://workers.tools"><img src="https://workers.tools/assets/img/logo.svg" width="100" height="100" /></a>
|
14 | <p align="center">This module is part of the Worker Tools collection<br/>β
|
15 |
|
16 | [Worker Tools](https://workers.tools) are a collection of TypeScript libraries for writing web servers in [Worker Runtimes](https://workers.js.org) such as Cloudflare Workers, Deno Deploy and Service Workers in the browser.
|
17 |
|
18 | If you liked this module, you might also like:
|
19 |
|
20 | - π§ [__Worker Router__][router] --- Complete routing solution that works across CF Workers, Deno and Service Workers
|
21 | - π [__Worker Middleware__][middleware] --- A suite of standalone HTTP server-side middleware with TypeScript support
|
22 | - π [__Worker HTML__][html] --- HTML templating and streaming response library
|
23 | - π¦ [__Storage Area__][kv-storage] --- Key-value store abstraction across [Cloudflare KV][cloudflare-kv-storage], [Deno][deno-kv-storage] and browsers.
|
24 | - π [__Response Creators__][response-creators] --- Factory functions for responses with pre-filled status and status text
|
25 | - π [__Stream Response__][stream-response] --- Use async generators to build streaming responses for SSE, etc...
|
26 | - π₯ [__JSON Fetch__][json-fetch] --- Drop-in replacements for Fetch API classes with first class support for JSON.
|
27 | - π¦ [__JSON Stream__][json-stream] --- Streaming JSON parser/stingifier with first class support for web streams.
|
28 |
|
29 | Worker Tools also includes a number of polyfills that help bridge the gap between Worker Runtimes:
|
30 | - βοΈ [__HTML Rewriter__][html-rewriter] --- Cloudflare's HTML Rewriter for use in Deno, browsers, etc...
|
31 | - π [__Location Polyfill__][location-polyfill] --- A `Location` polyfill for Cloudflare Workers.
|
32 | - π¦ [__Deno Fetch Event Adapter__][deno-fetch-event-adapter] --- Dispatches global `fetch` events using Denoβs native HTTP server.
|
33 |
|
34 | [router]: https://workers.tools/router
|
35 | [middleware]: https://workers.tools/middleware
|
36 | [html]: https://workers.tools/html
|
37 | [kv-storage]: https://workers.tools/kv-storage
|
38 | [cloudflare-kv-storage]: https://workers.tools/cloudflare-kv-storage
|
39 | [deno-kv-storage]: https://workers.tools/deno-kv-storage
|
40 | [kv-storage-polyfill]: https://workers.tools/kv-storage-polyfill
|
41 | [response-creators]: https://workers.tools/response-creators
|
42 | [stream-response]: https://workers.tools/stream-response
|
43 | [json-fetch]: https://workers.tools/json-fetch
|
44 | [json-stream]: https://workers.tools/json-stream
|
45 | [request-cookie-store]: https://workers.tools/request-cookie-store
|
46 | [extendable-promise]: https://workers.tools/extendable-promise
|
47 | [html-rewriter]: https://workers.tools/html-rewriter
|
48 | [location-polyfill]: https://workers.tools/location-polyfill
|
49 | [deno-fetch-event-adapter]: https://workers.tools/deno-fetch-event-adapter
|
50 |
|
51 | Fore more visit [workers.tools](https://workers.tools).
|