y-deferred
v0.3.0
Published
Deferred implementation
Downloads
18
Readme
Intro
Simple implementation of deferred object
Installation
npm i --save-dev y-deferred
# or
yarn add --dev y-deferred
Usage
import Deferred from 'y-deferred'
function test() {
const d = new Deferred()
setTimeout(() => {
d.resolve('done')
}, 1000)
return d
}
async function handleTest() {
const result = await test()
console.log(result) // 'done'
}
handleTest()
License
Copyright (c) 2017-present, Yuchen Liu