Cross Reference: /yui3/src/app/tests/manual/app-transitions.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
d9d247a8a6f960720e449399984fa3be10134d61Eric Ferraiuolo<!DOCTYPE html>
d9d247a8a6f960720e449399984fa3be10134d61Eric Ferraiuolo<html lang="en">
d9d247a8a6f960720e449399984fa3be10134d61Eric Ferraiuolo<head>
d9d247a8a6f960720e449399984fa3be10134d61Eric Ferraiuolo <meta charset="utf-8" />
d9d247a8a6f960720e449399984fa3be10134d61Eric Ferraiuolo <title>Foo App</title>
d9d247a8a6f960720e449399984fa3be10134d61Eric Ferraiuolo</head>
d9d247a8a6f960720e449399984fa3be10134d61Eric Ferraiuolo<body>
d9d247a8a6f960720e449399984fa3be10134d61Eric Ferraiuolo <script src="/build/yui/yui.js"></script>
d9d247a8a6f960720e449399984fa3be10134d61Eric Ferraiuolo <script>
d9d247a8a6f960720e449399984fa3be10134d61Eric Ferraiuolo YUI({
d9d247a8a6f960720e449399984fa3be10134d61Eric Ferraiuolo combine: false,
d9d247a8a6f960720e449399984fa3be10134d61Eric Ferraiuolo filter: 'RAW'
d9d247a8a6f960720e449399984fa3be10134d61Eric Ferraiuolo }).use('app', 'app-transitions', function (Y) {
d9d247a8a6f960720e449399984fa3be10134d61Eric Ferraiuolo Y.HappyView = Y.Base.create('SadView', Y.View, [], {
d9d247a8a6f960720e449399984fa3be10134d61Eric Ferraiuolo render: function () {
d9d247a8a6f960720e449399984fa3be10134d61Eric Ferraiuolo this.get('container').setContent('<p>I\'m a happy view :)</p>');
d9d247a8a6f960720e449399984fa3be10134d61Eric Ferraiuolo }
d9d247a8a6f960720e449399984fa3be10134d61Eric Ferraiuolo });
d9d247a8a6f960720e449399984fa3be10134d61Eric Ferraiuolo
d9d247a8a6f960720e449399984fa3be10134d61Eric Ferraiuolo Y.SadView = Y.Base.create('SadView', Y.View, [], {
d9d247a8a6f960720e449399984fa3be10134d61Eric Ferraiuolo render: function () {
d9d247a8a6f960720e449399984fa3be10134d61Eric Ferraiuolo this.get('container').setContent('<p>I\'m a sad view :(</p>');
d9d247a8a6f960720e449399984fa3be10134d61Eric Ferraiuolo }
d9d247a8a6f960720e449399984fa3be10134d61Eric Ferraiuolo });
d9d247a8a6f960720e449399984fa3be10134d61Eric Ferraiuolo
d9d247a8a6f960720e449399984fa3be10134d61Eric Ferraiuolo var MyAppClass = Y.Base.create('MyApp', Y.App, [], {
d9d247a8a6f960720e449399984fa3be10134d61Eric Ferraiuolo views: {
d9d247a8a6f960720e449399984fa3be10134d61Eric Ferraiuolo happy: {
d9d247a8a6f960720e449399984fa3be10134d61Eric Ferraiuolo type: Y.HappyView
d9d247a8a6f960720e449399984fa3be10134d61Eric Ferraiuolo },
d9d247a8a6f960720e449399984fa3be10134d61Eric Ferraiuolo sad: {
d9d247a8a6f960720e449399984fa3be10134d61Eric Ferraiuolo type: Y.SadView
d9d247a8a6f960720e449399984fa3be10134d61Eric Ferraiuolo }
d9d247a8a6f960720e449399984fa3be10134d61Eric Ferraiuolo }
d9d247a8a6f960720e449399984fa3be10134d61Eric Ferraiuolo }),
d9d247a8a6f960720e449399984fa3be10134d61Eric Ferraiuolo myAppInstance = new MyAppClass({transitions: true}).render(),
d9d247a8a6f960720e449399984fa3be10134d61Eric Ferraiuolo transition = function (counter) {
d9d247a8a6f960720e449399984fa3be10134d61Eric Ferraiuolo counter = counter || 0;
d9d247a8a6f960720e449399984fa3be10134d61Eric Ferraiuolo
d9d247a8a6f960720e449399984fa3be10134d61Eric Ferraiuolo if (counter >= 21) {
d9d247a8a6f960720e449399984fa3be10134d61Eric Ferraiuolo return;
d9d247a8a6f960720e449399984fa3be10134d61Eric Ferraiuolo }
d9d247a8a6f960720e449399984fa3be10134d61Eric Ferraiuolo
d9d247a8a6f960720e449399984fa3be10134d61Eric Ferraiuolo Y.later(100, null, function () {
d9d247a8a6f960720e449399984fa3be10134d61Eric Ferraiuolo myAppInstance.showView((counter % 2) ? 'happy' : 'sad');
d9d247a8a6f960720e449399984fa3be10134d61Eric Ferraiuolo transition(counter + 1);
d9d247a8a6f960720e449399984fa3be10134d61Eric Ferraiuolo });
d9d247a8a6f960720e449399984fa3be10134d61Eric Ferraiuolo };
d9d247a8a6f960720e449399984fa3be10134d61Eric Ferraiuolo
d9d247a8a6f960720e449399984fa3be10134d61Eric Ferraiuolo transition();
d9d247a8a6f960720e449399984fa3be10134d61Eric Ferraiuolo });
d9d247a8a6f960720e449399984fa3be10134d61Eric Ferraiuolo </script>
d9d247a8a6f960720e449399984fa3be10134d61Eric Ferraiuolo</body>
d9d247a8a6f960720e449399984fa3be10134d61Eric Ferraiuolo</html>