【文件属性】:
文件名称:JPromise:只是一个 PromiseA+ Javascript 库
文件大小:5KB
文件格式:ZIP
更新时间:2021-06-06 07:57:32
JavaScript
JPromise
使用方法
基本用法同Promise规范。
额外新增了progress方法,使用方法参考下例。
//常规调用 new JPromise(resolver);
new JPromise(function(resolve,reject,notify){
var t=setInterval(function(){
notify('progress');
},100);
setTimeout(function(){
//取消通知,否则会引发错误。
//因为一旦resolve后状态不允许更改,所以无法继续通知!
clearInterval(t);
//完成该任务
resolve('done!');
},2000);
}).then(function(v){
console.log(v); // done!
},function(v){
consol
【文件预览】:
JPromise-master
----index.html(5KB)
----src()
--------jpromise.js(9KB)
----README.md(2KB)