Skip to content

liuyuchenzh/y-deferred

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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

MIT

Copyright (c) 2017-present, Yuchen Liu

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Packages

No packages published