fan.js
is a implementation of the Promise/A+ spec written in ES5. It uses a simple and easy-to-understand style that closely matches every line of the spec. fan.js
is a good example to reference when creating your own Promise and to help you learn the Promise/A+ spec.
- Read the specification with use cases. Do it again if you have no idea how to begin.
- Define the Promise class or constructor.
- Make the Promises/A+ Compliance Test Suite works well with your code.
- Define the then() method.
- Implement chaining.
- Handle errors.
fan.js
has passed all the tests in the Promises/A+ Compliance Test Suite.
To run all the tests, use the following command:
npm run test
The Promises/A+ Compliance Test Suite organizes tests by spec requirements. If you want to run the tests for a specific requirement, use a command like:
npm run test -- grep 2.1.2