Skip to content

tiaanduplessis/nap

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

15 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

nap

Unfancy promise based sleep function

Table of Contents

Table of Contents
  • Install
  • Usage
  • Contribute
  • License
  • Install

    Greenkeeper badge

    $ npm install @tiaanduplessis/nap
    # OR
    $ yarn add @tiaanduplessis/nap

    Usage

    import nap from '@tiaanduplessis/nap'
    
    nap().then(() => console.log('Took a 1 sec nap'))
    nap(3000).then(() => console.log('Took a 3 sec nap'))
    nap(5000).then(() => console.log('Took a 5 sec nap'))
    
    async function doThings () {
      await nap(4000)
      console.log('Took a 4 sec nap')
    }
    
    doThings()
    
    // Took a 1 sec nap
    // Took a 3 sec nap
    // Took a 4 sec nap
    // Took a 5 sec nap

    Contributing

    Contributions are welcome!

    1. Fork it.
    2. Create your feature branch: git checkout -b my-new-feature
    3. Commit your changes: git commit -am 'Add some feature'
    4. Push to the branch: git push origin my-new-feature
    5. Submit a pull request :D

    Or open up a issue.

    License

    MIT

    About

    Unfancy promise based sleep function

    Topics

    Resources

    License

    Stars

    Watchers

    Forks

    Packages

    No packages published