Skip to content

taowangpro/wait

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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
  ...
}

About

Wait for user calm down a bit, then response user'

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published