Make WordPress Core

Changes between Initial Version and Version 1 of Ticket #26086, comment 3


Ignore:
Timestamp:
11/18/2013 04:50:37 PM (11 years ago)
Author:
azaozz
Comment:

Legend:

Unmodified
Added
Removed
Modified
  • Ticket #26086, comment 3

    initial v1  
    55{{{
    66// `i` is just for testing, paste in the browser console and try it
    7 var timeout, timerSet, i = 0;
     7var timeout, i = 0;
    88
    99function fireOnce() {
    10   if ( timerSet ) {
    11     clearTimeout( timeout );
    12   }
    13   timeout = setTimeout( function() { i++; timerSet = false; console.log('run = '+i); }, 200 );
    14   timerSet = true;
     10  clearTimeout( timeout );
     11  timeout = setTimeout( function() { i++; console.log('run = '+i); }, 200 );
    1512}
    1613