~ubuntu-branches/ubuntu/utopic/moodle/utopic

« back to all changes in this revision

Viewing changes to lib/yuilib/3.9.1/build/event-resize/event-resize-debug.js

  • Committer: Package Import Robot
  • Author(s): Thijs Kinkhorst
  • Date: 2014-05-12 16:10:38 UTC
  • mfrom: (36.1.3 sid)
  • Revision ID: package-import@ubuntu.com-20140512161038-puyqf65k4e0s8ytz
Tags: 2.6.3-1
New upstream release.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/* YUI 3.9.1 (build 5852) Copyright 2013 Yahoo! Inc. http://yuilibrary.com/license/ */
2
 
YUI.add('event-resize', function (Y, NAME) {
3
 
 
4
 
/**
5
 
 * Adds a window resize event that has its behavior normalized to fire at the
6
 
 * end of the resize rather than constantly during the resize.
7
 
 * @module event
8
 
 * @submodule event-resize
9
 
 */
10
 
 
11
 
 
12
 
/**
13
 
 * Old firefox fires the window resize event once when the resize action
14
 
 * finishes, other browsers fire the event periodically during the
15
 
 * resize.  This code uses timeout logic to simulate the Firefox 
16
 
 * behavior in other browsers.
17
 
 * @event windowresize
18
 
 * @for YUI
19
 
 */
20
 
Y.Event.define('windowresize', {
21
 
 
22
 
    on: (Y.UA.gecko && Y.UA.gecko < 1.91) ?
23
 
        function (node, sub, notifier) {
24
 
            sub._handle = Y.Event.attach('resize', function (e) {
25
 
                notifier.fire(e);
26
 
            });
27
 
        } :
28
 
        function (node, sub, notifier) {
29
 
            // interval bumped from 40 to 100ms as of 3.4.1
30
 
            var delay = Y.config.windowResizeDelay || 100;
31
 
 
32
 
            sub._handle = Y.Event.attach('resize', function (e) {
33
 
                if (sub._timer) {
34
 
                    sub._timer.cancel();
35
 
                }
36
 
 
37
 
                sub._timer = Y.later(delay, Y, function () {
38
 
                    notifier.fire(e);
39
 
                });
40
 
            });
41
 
        },
42
 
 
43
 
    detach: function (node, sub) {
44
 
        if (sub._timer) {
45
 
            sub._timer.cancel();
46
 
        }
47
 
        sub._handle.detach();
48
 
    }
49
 
    // delegate methods not defined because this only works for window
50
 
    // subscriptions, so...yeah.
51
 
});
52
 
 
53
 
 
54
 
}, '3.9.1', {"requires": ["node-base", "event-synthetic"]});