lib/lupusasync.js
/**
  * Execute a callback function after x msec with a delayname. if you call callByDelay
  * again, with a callback funtion, the older one will be canceld if not executed
  * till now
  * @param {*} callback 
  * @param {*} delayname 
  */
Execute a callback function after x msec with a delayname. if you call callByDelay
again, with a callback funtion, the older one will be canceld if not executed
till now
@param {*} callback
@param {*} delayname
Execute a callback function after x msec with a delayname . if you call callByDelay again with a callback funtion the older one will be canceld if not executed till now @param { * } callback @param { * } delayname
callByDelay(callback, id, statusname, delay) {
    let handle = this.getCallByDelayObj(id, statusname);
    if (delay === undefined) delay = 500;
    if (handle) {
      clearTimeout(handle);
    }
    if (!this.callByDelayObj[id]) this.callByDelayObj[id] = {};
    handle = setTimeout(() => {
      delete this.callByDelayObj[id][statusname];
      callback();
    }, delay);
    this.setCallByDelayObj(id, statusname, handle);
  }
callByDelay ( callback , id , statusname , delay ) { let handle = this . getCallByDelayObj ( id , statusname ) ; if ( delay === undefined ) delay = 500 ; if ( handle ) { clearTimeout ( handle ) ; } if ( ! this . callByDelayObj [ id ] ) this . callByDelayObj [ id ] = { } ; handle = setTimeout ( ( ) => { delete this . callByDelayObj [ id ] [ statusname ] ; callback ( ) ; } , delay ) ; this . setCallByDelayObj ( id , statusname , handle ) ; }
Execute a callback function after x msec with a delayname.
Execute a callback function after x msec with a delayname .