wait-ui

1.0.4 • Public • Published

wait-ui

Wait for a certain amount quiet time before calling function execution. It is purposely slow down the response for user's interaction.

Why

It is not necessary to response that fast or this response become costly to do. Say, typeahead call to fetch suggestion only after user stop typing; Mouseover show sub menu only when users's mouse stop on a item...

API

const waitUI = require('wait-ui');

waitUI(fn, msec, scope);

Usage

// set up component
[component].onMouseover(waitUI(this.handleMouseover, 300, this))

// the very last mouseover event happen 300ms ago
handleMouseover(event) {
  // this is this
  ...
}

Readme

Keywords

Package Sidebar

Install

npm i wait-ui

Weekly Downloads

4

Version

1.0.4

License

ISC

Unpacked Size

2.29 kB

Total Files

7

Last publish

Collaborators

  • taowangpro