@x_m/utils
v0.1.9
Published
common utils
Downloads
1
Readme
@x_m/utils
一些常用功能函数
install
yarn add @x_m/utils
examples
genePromiseOnce
// expensiveButStorableAsyncFunction will be called only once forever, unless rejected
const promiseOnce = genePromiseOnce(expensiveButStorableAsyncFunction)
window.addEventListener('resize', () => {
promiseOnce()
.then((res) => {
console.log(`promise successed: ${res}`)
})
.catch(() => {
console.log('catch')
})
})
sleepMs
async function() {
await sleepMs(500)
}