event-resize-debug.js revision 76ca635d61eb3f9fb7c9d788a44fa8b1690aa138
76ca635d61eb3f9fb7c9d788a44fa8b1690aa138Dav Glass * Adds a window resize event that has its behavior normalized to fire at the
76ca635d61eb3f9fb7c9d788a44fa8b1690aa138Dav Glass * end of the resize rather than constantly during the resize.
76ca635d61eb3f9fb7c9d788a44fa8b1690aa138Dav Glass * @module event
76ca635d61eb3f9fb7c9d788a44fa8b1690aa138Dav Glass * @submodule event-resize
76ca635d61eb3f9fb7c9d788a44fa8b1690aa138Dav Glass(function() {
76ca635d61eb3f9fb7c9d788a44fa8b1690aa138Dav Glass handler = function(e) {
76ca635d61eb3f9fb7c9d788a44fa8b1690aa138Dav Glass timerHandle = Y.later(Y.config.windowResizeDelay || 40, Y, function() {
76ca635d61eb3f9fb7c9d788a44fa8b1690aa138Dav Glass * Firefox fires the window resize event once when the resize action
76ca635d61eb3f9fb7c9d788a44fa8b1690aa138Dav Glass * finishes, other browsers fire the event periodically during the
76ca635d61eb3f9fb7c9d788a44fa8b1690aa138Dav Glass * resize. This code uses timeout logic to simulate the Firefox
76ca635d61eb3f9fb7c9d788a44fa8b1690aa138Dav Glass * behavior in other browsers.
76ca635d61eb3f9fb7c9d788a44fa8b1690aa138Dav Glass * @event windowresize
76ca635d61eb3f9fb7c9d788a44fa8b1690aa138Dav Glass // check for single window listener and add if needed
76ca635d61eb3f9fb7c9d788a44fa8b1690aa138Dav Glass detachHandle = Y.Event._attach(['resize', handler]);