]>
git.wh0rd.org - tt-rss.git/blob - lib/dojo/fx/Toggler.js.uncompressed.js
1 define("dojo/fx/Toggler", ["../_base/lang","../_base/declare","../_base/fx", "../_base/connect"],
2 function(lang
, declare
, baseFx
, connectUtil
){
6 return declare("dojo.fx.Toggler", null, {
8 // A simple `dojo.Animation` toggler API.
10 // class constructor for an animation toggler. It accepts a packed
11 // set of arguments about what type of animation to use in each
12 // direction, duration, etc. All available members are mixed into
13 // these animations from the constructor (for example, `node`,
14 // `showDuration`, `hideDuration`).
16 // | var t = new dojo/fx/Toggler({
18 // | showDuration: 500,
19 // | // hideDuration will default to "200"
20 // | showFunc: dojo/fx/wipeIn,
21 // | // hideFunc will default to "fadeOut"
23 // | t.show(100); // delay showing for 100ms
24 // | // ...time passes...
28 // the node to target for the showing and hiding animations
32 // The function that returns the `dojo.Animation` to show the node
33 showFunc
: baseFx
.fadeIn
,
36 // The function that returns the `dojo.Animation` to hide the node
37 hideFunc
: baseFx
.fadeOut
,
40 // Time in milliseconds to run the show Animation
44 // Time in milliseconds to run the hide Animation
47 // FIXME: need a policy for where the toggler should "be" the next
48 // time show/hide are called if we're stopped somewhere in the
50 // FIXME: also would be nice to specify individual showArgs/hideArgs mixed into
51 // each animation individually.
52 // FIXME: also would be nice to have events from the animations exposed/bridged
65 constructor: function(args
){
70 _t
._showArgs
= lang
.mixin({}, args
);
71 _t
._showArgs
.node
= _t
.node
;
72 _t
._showArgs
.duration
= _t
.showDuration
;
73 _t
.showAnim
= _t
.showFunc(_t
._showArgs
);
75 _t
._hideArgs
= lang
.mixin({}, args
);
76 _t
._hideArgs
.node
= _t
.node
;
77 _t
._hideArgs
.duration
= _t
.hideDuration
;
78 _t
.hideAnim
= _t
.hideFunc(_t
._hideArgs
);
80 connectUtil
.connect(_t
.showAnim
, "beforeBegin", lang
.hitch(_t
.hideAnim
, "stop", true));
81 connectUtil
.connect(_t
.hideAnim
, "beforeBegin", lang
.hitch(_t
.showAnim
, "stop", true));
84 show: function(delay
){
86 // Toggle the node to showing
88 // Amount of time to stall playing the show animation
89 return this.showAnim
.play(delay
|| 0);
92 hide: function(delay
){
94 // Toggle the node to hidden
96 // Amount of time to stall playing the hide animation
97 return this.hideAnim
.play(delay
|| 0);