double-click-blocking-util

0.0.1 • Public • Published

Double-Click-Blocking-Util

Caution

in use es6

Start

  npm install double-click-blocking-util --save

react example

  import DoubleClickBlocking from 'double-click-blocking-util'

  class Container extends React.Component {
    DoubleClickBlocking = new DoubleClickBlocking();
    
    requestAPI=(e)=>{
      let delay = 5000;
      // Stop for 5 seconds
      if(this.DoubleClickBlocking.isBlocking(delay) === true){
					return ;
      }
      // 1 call for 5 seconds
      ...
    }

    responseAPI=()=>{
      // blocking stop
      this.DoubleClickBlocking.stop()
    }

    render(){
      return(
        <div onClick={this.requestAPI}> 
          requestAPI
        </div>
      )
    }
  }

Package Sidebar

Install

npm i double-click-blocking-util

Weekly Downloads

1

Version

0.0.1

License

ISC

Unpacked Size

2.97 kB

Total Files

4

Last publish

Collaborators

  • sujkh85