All Projects → lqt0223 → promise

lqt0223 / promise

Licence: other
A step by step implementation practice of Promise class

Programming Languages

javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to promise

rake
A Java library for Rapid Automatic Keyword Extraction (RAKE) 🍂
Stars: ✭ 23 (-25.81%)
Mutual labels:  implementation
ComputerNetworks-unipd2018
Tips and resources to easily pass the "Computer Networks" practical exam ("Reti di calcolatori") in Padua
Stars: ✭ 21 (-32.26%)
Mutual labels:  implementation
nice-grpc
A TypeScript gRPC library that is nice to you
Stars: ✭ 120 (+287.1%)
Mutual labels:  promise
webpack2-polyfill-plugin
Insert polyfills (such as Promise) for Webpack 2
Stars: ✭ 18 (-41.94%)
Mutual labels:  promise
easy-promise-queue
An easy JavaScript Promise queue which is automatically executed, concurrency controlled and suspendable.
Stars: ✭ 31 (+0%)
Mutual labels:  promise
freenom
🌐 Feenom Promise/Async/Await
Stars: ✭ 19 (-38.71%)
Mutual labels:  promise
code-snippets
✍️ code - 手写系列
Stars: ✭ 41 (+32.26%)
Mutual labels:  implementation
event-worker
A simpler way of dealing with Web Workers
Stars: ✭ 18 (-41.94%)
Mutual labels:  promise
organiser
An organic web framework for organized web servers.
Stars: ✭ 58 (+87.1%)
Mutual labels:  promise
sfdx-lightning-api-component
⚡️ Promise-based service component for calling REST API from Lightning Aura Components without Named Credentials.
Stars: ✭ 62 (+100%)
Mutual labels:  promise
routeros-client
Abstraction layer over the node-routeros API
Stars: ✭ 63 (+103.23%)
Mutual labels:  promise
Pixel-Processing
📷 This repository is focused on having various feature implementation of OpenCV in Python. The aim is to have a minimal implementation of all OpenCV features together, under one roof.
Stars: ✭ 122 (+293.55%)
Mutual labels:  implementation
combine-promises
Like Promise.all(array) but with an object instead of an array.
Stars: ✭ 181 (+483.87%)
Mutual labels:  promise
ws-promise
A tiny, Promise-based WebSocket protocol allowing request-response usage in ECMAScript
Stars: ✭ 20 (-35.48%)
Mutual labels:  promise
Promise
Asynchronous Programming with Promises
Stars: ✭ 15 (-51.61%)
Mutual labels:  promise
kuromojin
Provide a high-level wrapper for kuromoji.js. Cache/Promise API
Stars: ✭ 64 (+106.45%)
Mutual labels:  promise
wise-river
Object streaming the way it should be.
Stars: ✭ 33 (+6.45%)
Mutual labels:  promise
Eventually
A Swift Future/Promise library that can be used to model and transform asynchronous results
Stars: ✭ 19 (-38.71%)
Mutual labels:  promise
promise
Common interface for simple asynchronous placeholders.
Stars: ✭ 66 (+112.9%)
Mutual labels:  promise
oledb
A small promised based module which uses edge.js to connect to an OLE DB, ODBC or SQL database.
Stars: ✭ 28 (-9.68%)
Mutual labels:  promise

A step by step implementation practice of Promise

This repository shows implementation of the Promise class in JavaScript.

As Promise is a rather complex mechanism, this repository displays the full implementation gradually by providing each of the following phases in the implementation. Each phases are marked with a git tag. The phases are:

  1. basic: a promise is an object that receives a function as parameter. When created, the function will be fired immediately

  2. job scheduling: a promise is 'Thenable' and can call 'Promise.prototype.then' to schedule deferred jobs. When the promise is resolved, the callback in 'then' body will be called and the resolved value will be retrieved

  3. chaining: a 'then' body will return a new Promise, which is also 'Thenable'. Once the first promise is fired, the promise chain will do the resolution towards its end automatically

  4. status control: a promise has a initial state of 'pending', and will shift either to 'resolved' or 'rejected'

  5. error handling: Promise.prototype.then' with error handler & Promise.prototype.catch' are ways to handle errors

  6. error propagation: a rejected reason will be propagated to the nearest error handler or catch body. Jobs between the rejection and the nearest error handler would not be executed. After the error handling, the promise chain resumes execution

  7. auto-resolution of promise in then / catch body: a promise returned from the callback in either a then or catch body will be automatically resolved or rejected, and the resolved value or rejected reason will appear in the next chained promise body

  8. exception capture: besides explicit rejection, a promise can capture a thrown error or exception in its body

  9. static methods: "Promise.resolve", "Promise.reject", "Promise.all" & "Promise.reject"

  10. re-thenablilty: by calling 'Promise.prototype.then' on a promise multiple times, concurrent async jobs are scheduled

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].