1.0.0 • Published 4 years ago
hj-company-common v1.0.0
hj-company-common
hj项目公共方法
yarn add hj-company-common
import { singleton } from 'hj-company-common'
function test() {
return new Promise(res => {
console.log('test')
setTimeout(() => {
res('test')
}, 1000);
})
}
// 实际test 方法只执行了一遍
const _test = singleton(test)
_test().then(res => {
console.log('test1', res)
});
_test().then(res => {
console.log('test2', res)
});
1.0.0
4 years ago