Skip to content
Tiny asynchronous action timer.
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
.gitignore
README.md
index.js
package-lock.json
package.json

README.md

w2t

Tiny asynchronous action timer. 130 bytes gzipped.

Install

npm i w2t --save

Usage

Sometimes UI actions feel more human if we delay them instead of allowing them to be completed at computer time. w2t allows you to specify actions and a minimum time for them to be completed before the Promise is resolved.

import wait from 'w2t'

function addToCart (items) {
  // show loading state

  wait(600, [
    addItemsToCart(items)
  ]).then(() => {
    // success, hide loading state
  })
}

License

MIT License © Eric Bailey

You can’t perform that action at this time.