13
13
* @submodule yui-later
19
* Executes the supplied function in the context of the supplied
20
* object 'when' milliseconds later. Executes the function a
21
* single time unless periodic is set to true.
24
* @param when {int} the number of milliseconds to wait until the fn
26
* @param o the context object.
27
* @param fn {Function|String} the function to execute or the name of
28
* the method in the 'o' object to execute.
29
* @param data [Array] data that is provided to the function. This accepts
30
* either a single item or an array. If an array is provided, the
31
* function is executed with one parameter for each array item. If
32
* you need to pass a single array parameter, it needs to be wrapped in
34
* @param periodic {boolean} if true, executes continuously at supplied
35
* interval until canceled.
36
* @return {object} a timer object. Call the cancel() method on this object to
39
later = function(when, o, fn, data, periodic) {
44
if (o && L.isString(fn)) {
17
* Executes the supplied function in the context of the supplied
18
* object 'when' milliseconds later. Executes the function a
19
* single time unless periodic is set to true.
22
* @param when {int} the number of milliseconds to wait until the fn
24
* @param o the context object.
25
* @param fn {Function|String} the function to execute or the name of
26
* the method in the 'o' object to execute.
27
* @param data [Array] data that is provided to the function. This
28
* accepts either a single item or an array. If an array is provided,
29
* the function is executed with one parameter for each array item.
30
* If you need to pass a single array parameter, it needs to be wrapped
31
* in an array [myarray].
32
* @param periodic {boolean} if true, executes continuously at supplied
33
* interval until canceled.
34
* @return {object} a timer object. Call the cancel() method on this
35
* object to stop the timer.
37
Y.later = function(when, o, fn, data, periodic) {
42
if (o && Y.Lang.isString(fn)) {
46
f = !Y.Lang.isUndefined(data) ? function() {
47
m.apply(o, Y.Array(data));
52
id = (periodic) ? setInterval(f, when) : setTimeout(f, when);
48
f = !L.isUndefined(data) ? function() {
49
m.apply(o, Y.Array(data));
54
id = (periodic) ? setInterval(f, when) : setTimeout(f, when);
75
}, '3.2.0' ,{requires:['yui-base']});
67
Y.Lang.later = Y.later;
71
}, '3.3.0' ,{requires:['yui-base']});