1 //>>excludeStart("jqmBuildExclude", pragmas.jqmBuildExclude);
2 //>>description: Throttled resize event
3 //>>label: throttledresize
6 define( [ "jquery" ], function( jQuery ) {
7 //>>excludeEnd("jqmBuildExclude");
9 // throttled resize event
11 $.event.special.throttledresize = {
13 $( this ).bind( "resize", handler );
15 teardown: function() {
16 $( this ).unbind( "resize", handler );
21 handler = function() {
22 curr = ( new Date() ).getTime();
23 diff = curr - lastCall;
25 if ( diff >= throttle ) {
28 $( this ).trigger( "throttledresize" );
33 clearTimeout( heldCall );
36 // Promise a held call will still execute
37 heldCall = setTimeout( handler, throttle - diff );
45 //>>excludeStart("jqmBuildExclude", pragmas.jqmBuildExclude);
47 //>>excludeEnd("jqmBuildExclude");