Popular Posts
javax.net.ssl.SSLHandshakeException: Connection closed by peer in Android 5.0 Lollipop Recently, there is a error occurs when access website via ssl connection like below although it worked fine several days ago. // Enable SSL... Enable SSL connection for Jsoup import org.jsoup.Connection; import org.jsoup.Jsoup; import javax.net.ssl.*; import java.io.IOException; import java.security.KeyManagement... set/remove cookie using applet jdk/jre 1.4 later, the library is included in plugin.jar file. import java.applet.Applet; import java.util.ArrayList; import java.util.Date;...
Stats
Memo: Debounce Task

To prevent multi-execution from caller in short time, use debounce for single execution.

  1. var debounce = function (func, threshold, execAsap) {
  2. var timeout;
  3. return function debounced () {
  4. var obj = this, args = arguments;
  5. function delayed () {
  6. if (!execAsap)
  7. func.apply(obj, args);
  8. timeout = null;
  9. };
  10. if (timeout)
  11. clearTimeout(timeout);
  12. else if (execAsap)
  13. func.apply(obj, args);
  14. timeout = setTimeout(delayed, threshold || 100);
  15. };
  16. }