3
Copyright 2012 Yahoo! Inc. All rights reserved.
4
Licensed under the BSD License.
5
http://yuilibrary.com/license/
7
YUI.add('event-resize', function(Y) {
10
* Adds a window resize event that has its behavior normalized to fire at the
11
* end of the resize rather than constantly during the resize.
13
* @submodule event-resize
18
* Old firefox fires the window resize event once when the resize action
19
* finishes, other browsers fire the event periodically during the
20
* resize. This code uses timeout logic to simulate the Firefox
21
* behavior in other browsers.
25
Y.Event.define('windowresize', {
27
on: (Y.UA.gecko && Y.UA.gecko < 1.91) ?
28
function (node, sub, notifier) {
29
sub._handle = Y.Event.attach('resize', function (e) {
33
function (node, sub, notifier) {
34
// interval bumped from 40 to 100ms as of 3.4.1
35
var delay = Y.config.windowResizeDelay || 100;
37
sub._handle = Y.Event.attach('resize', function (e) {
42
sub._timer = Y.later(delay, Y, function () {
48
detach: function (node, sub) {
54
// delegate methods not defined because this only works for window
55
// subscriptions, so...yeah.
59
}, '3.5.1' ,{requires:['event-synthetic']});