Skip to content

Instantly share code, notes, and snippets.

View cnanders's full-sized avatar

Chris Anderson cnanders

  • Berkeley, CA
View GitHub Profile
@cnanders
cnanders / PromiseSimple.js
Last active October 24, 2019 18:49 — forked from treyhuffine/PromiseSimple.js
A simple JavaScript Promise implementation for education purposes
class PromiseSimple {
constructor(executionFunction) {
this.promiseChain = [];
this.handleError = () => {};
this.onResolve = this.onResolve.bind(this);
this.onReject = this.onReject.bind(this);
// executing this function either calls this.onResolve
// or this.onReject