- The client comes from a religious background and isn't comfortable with the word "promise" being part of their software
- The client wants a new class to replace the Promise, called... Declare
- you can clone this boilerplate Repo or create a new one.
- Edit or add index.js to implement the Declare class.
- is not implemented using the built-in Promise Class.
- can create an instance with an executor function using the new keyword
- has a then method, which returns a Declare instance
- can use the return value of the executor with then method
- can use multiple thens chained one after the other
- can use an asynchronous executor
- NOTE - there's no need to handle errors in this implementation.
test.skip("Is not an instance of Promise", () => {
const declare = new Declare(()=>{});
return expect(declare instanceof Promise).toBe(false);
});-
How Promise works? Promise MDN Promises - why!? Callback-Hell VS Promises
-
JS classes + constructor: class guide class MDN
-
JS, how does it reads your code? Asynchrony: Under the Hood
-
bind is a method in js, which pssing a 'this' value, to another function. it is necessary to use this method in the implementation.
(learn more here)[https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function/bind]

