promise78
v0.0.3
Published
no try catch;let [err,data]= await Promise78func()
Downloads
6
Maintainers
Readme
English | 简体中文
「Promise78」是一个开源的改造promise函数,避免了try问题。
promise封装
- 不要try catch
- no try catch
- 返回[err,back]
- reback [err,back]
- if(err)告警然后返回即可;然后使用back值
- if(err)warn and return ;get back
适用端 apply
use for js ts
project
|端|支持| |---|---| |Web|√| |微信小程序|√| |iOS|√| |Android|√|
依赖 rely on
nothing
属性 props
nothing
方法 method
nothing
DEMO
...
import Promise78 from "@www778878net/promise78"
function test() {
return new Promise78((resolve, reject) => {
setTimeout(() => {
reject("testerr")
}, 1000)
})
}
let [err, back] = await test();
if(err){
console.log(err)
return
}
...
OTHER
https://github.com/www778878net/promise78.git you can see test/test.js