Giter VIP home page Giter VIP logo

sleepover's Introduction

sleepover Tests

Step, loop & sleep methods

Install

$ npm install sleepover

Usage

const { sleep, over, snooze } = require('sleepover')

sleep(500)
//=> delays execution for 500ms using Atomics.wait

over(30, (i) => console.log(i))
//=> loops 30 times, calling the provided method each time

async function something() {
  await snooze(500)
  //=> delays execution for 500ms using async/await + Promise + setTimeout
}

API

sleep(delay)

delay

Type: number

The number, in ms, that you'd like to delay execution of your code. (utilizes the Atomics API under the hood)

over(times, callback)

times

Type: number

The number of times you would like to loop/iterate.

callback

Type: function

The callback function you want executed on each iteration (it gets provided a single index argument).

snooze(delay)

delay

Type: number

The number, in ms, that you'd like to delay execution of your code. (utilizes a Promise + setTimeout)

atomics

Type: boolean

Result of the test conditions for defining Atomics support in the current environment. Use this to determine whether ot use sleep or snooze respectively.

License

MIT Β© Darcy Clarke

sleepover's People

Contributors

darcyclarke avatar greenkeeper[bot] avatar iansu avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

Forkers

iansu

sleepover's Issues

An in-range update of standard is breaking the build 🚨

The devDependency standard was updated from 13.0.2 to 13.1.0.

🚨 View failing branch.

This version is covered by your current version range and after updating it in your project the build failed.

standard is a devDependency of this project. It might not break your production code or affect downstream projects, but probably breaks your build or test tools, which may prevent deploying or publishing.

Status Details
  • ❌ continuous-integration/travis-ci/push: The Travis CI build failed (Details).

Commits

The new version differs by 7 commits.

  • ef2351a Update AUTHORS.md
  • 60b616f 13.1.0
  • 8493c9d Update CHANGELOG.md
  • 588e505 Merge pull request #1337 from standard/greenkeeper/eslint-6.1.0
  • 9040ae8 fix(package): update eslint to version 6.1.0
  • a263dfc Merge pull request #1336 from epixian/patch-1
  • 15a1105 added oxford comma for consistency with next line

See the full diff

FAQ and help

There is a collection of frequently asked questions. If those don’t help, you can always ask the humans behind Greenkeeper.


Your Greenkeeper Bot 🌴

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.