0.2.0 • Published 7 years ago
your-async-share v0.2.0
your-async-share
npm i your-async-share
asyncShare(fn)
同时调用异步方法,只执行一次,并共享结果
import asyncShare from 'your-async-share'
const oldMethod = () => {
// 返回 Promise 实例
}
const newMethod = asyncShare(oldMethod)
newMethod()
newMethod()