/** 异步函数回调简化处理
const promisify = require('./promisify')
const getSystemInfo = promisify(wx.getSystemInfo) getSystemInfo().then(res=>{
// success
console.log(res)
}).catch(res=>{ })
**/
module.exports = (api) => {
return (options, ...params) => {
return new Promise((resolve, reject) => {
console.log(options)
console.info(...params)
api(Object.assign({}, options, {
success: resolve,
fail: reject
}), ...params);
});
}
}