Skip to content

SAKISMMMMMM/my-promise

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

my-promise

目录结构

my-promise            
├─ LICENSE            
├─ README.md          
├─ my-promise.js ..................... 手写代码    
├─ package-lock.json  
├─ package.json ...................... npm run test 运行 Promise A+ test    
└─ test.js ........................... 面试题测试           

Promise A+ 测试

  1. 安装一下
npm install promises-aplus-tests -D 
  1. 手写代码中加入 deferred
MyPromise {
  ......
}

MyPromise.deferred = function () {
  var result = {};
  result.promise = new MyPromise(function (resolve, reject) {
    result.resolve = resolve;
    result.reject = reject;
  });

  return result;
}
module.exports = MyPromise;
  1. 配置启动命令
// package.json

"scripts": {
  "test": "promises-aplus-tests my-promise"
},

开启测试

npm run test

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • JavaScript 100.0%