Last active
September 16, 2019 14:37
-
-
Save aarongustafson/4157402 to your computer and use it in GitHub Desktop.
Revisions
-
aarongustafson revised this gist
Nov 21, 2014 . 1 changed file with 27 additions and 28 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,29 +1,28 @@ (function( window ){ window.watchResize = function( callback ){ var resizing; callback.size = 0; function done() { var curr_size = window.innerWidth; clearTimeout( resizing ); resizing = null; // only run on a true resize if ( callback.size != curr_size ) { callback(); callback.size = curr_size; } } window.addEventListener('resize', function(){ if ( resizing ) { clearTimeout( resizing ); resizing = null; } resizing = setTimeout( done, 50 ); }); // init callback(); }; }(window)); -
aarongustafson revised this gist
Nov 27, 2012 . 2 changed files with 25 additions and 23 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,27 +1,29 @@ (function(window){ window.watchResize = function(callback) { var resizing; callback.size = 0; function done() { var curr_size = window.innerWidth; clearTimeout( resizing ); resizing = null; // only run on a true resize if ( callback.size != curr_size ) { callback(); callback.size = curr_size; } } window.addEventListener('resize', function(){ if ( resizing ) { clearTimeout( resizing ); resizing = null; } resizing = setTimeout( done, 50 ); }); // init callback(); }; }(window)); This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1 +1 @@ (function(a){a.watchResize=function(d){var c;d.size=0;function b(){var e=a.innerWidth;clearTimeout(c);c=null;if(d.size!=e){d();d.size=e}}a.addEventListener("resize",function(){if(c){clearTimeout(c);c=null}c=setTimeout(b,50)});d()}}(window)); -
aarongustafson revised this gist
Nov 27, 2012 . 1 changed file with 1 addition and 0 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1 @@ window.watchResize=function(c){var b;c.size=0;function a(){var d=window.innerWidth;clearTimeout(b);b=null;if(c.size!=d){c();c.size=d}}window.addEventListener("resize",function(){if(b){clearTimeout(b);b=null}b=setTimeout(a,50)});c()}; -
aarongustafson created this gist
Nov 27, 2012 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,27 @@ window.watchResize = function(callback) { var resizing; callback.size = 0; function done() { var curr_size = window.innerWidth; clearTimeout( resizing ); resizing = null; // only run on a true resize if ( callback.size != curr_size ) { callback(); callback.size = curr_size; } } window.addEventListener('resize', function(){ if ( resizing ) { clearTimeout( resizing ); resizing = null; } resizing = setTimeout( done, 50 ); }); // init callback(); };