1
1
exports . install = function ( framework ) {
2
- framework . route ( '/' , viewHomepage , [ '+xhr' ] ) ;
2
+ framework . route ( '/' , view_index ) ;
3
3
} ;
4
4
5
- function viewHomepage ( ) {
5
+ function view_index ( ) {
6
+
6
7
var self = this ;
7
8
var builder = [ ] ;
8
9
9
- // Documentation: http://docs.totaljs.com/Async/
10
10
self . await ( function ( complete ) {
11
-
12
- // Documentation: http://docs.totaljs.com/FrameworkUtils/#utils.request
13
- utils . request ( 'https://www.google.com' , 'GET' , null , function ( err , data ) {
11
+ utils . request ( 'https://www.google.com' , [ 'get' ] , null , function ( err , data ) {
14
12
var output = err ? 'error' : data . length . toString ( ) ;
15
13
builder . push ( 'www.google.com -> ' + output ) ;
16
14
complete ( ) ;
17
15
} ) ;
18
16
} ) ;
19
17
20
18
self . await ( function ( complete ) {
21
-
22
- // Documentation: http://docs.totaljs.com/FrameworkUtils/#utils.request
23
- utils . request ( 'http://www.expressjs.com' , 'GET' , null , function ( err , data ) {
19
+ utils . request ( 'http://www.expressjs.com' , [ 'get' ] , null , function ( err , data ) {
24
20
var output = err ? 'error' : data . length . toString ( ) ;
25
21
builder . push ( 'www.expressjs.com -> ' + output ) ;
26
22
complete ( ) ;
27
23
} ) ;
28
24
} ) ;
29
25
30
26
self . await ( function ( complete ) {
31
-
32
- // Documentation: http://docs.totaljs.com/FrameworkUtils/#utils.request
33
- utils . request ( 'http://www.yahoo.com' , 'GET' , null , function ( err , data ) {
27
+ utils . request ( 'http://www.yahoo.com' , [ 'get' ] , null , function ( err , data ) {
34
28
var output = err ? 'error' : data . length . toString ( ) ;
35
29
builder . push ( 'www.yahoo.com -> ' + output ) ;
36
30
complete ( ) ;
37
31
} ) ;
38
32
} ) ;
39
33
40
34
self . await ( 'partial' , function ( complete ) {
41
-
42
- // Documentation: http://docs.totaljs.com/FrameworkUtils/#utils.request
43
- utils . request ( 'http://www.totaljs.com' , 'GET' , null , function ( err , data ) {
35
+ utils . request ( 'http://www.totaljs.com' , [ 'get' ] , null , function ( err , data ) {
44
36
var output = err ? 'error' : data . length . toString ( ) ;
45
37
builder . push ( 'www.totaljs.com -> ' + output ) ;
46
38
complete ( ) ;
@@ -64,8 +56,8 @@ function viewHomepage() {
64
56
} ) ;
65
57
66
58
/*
67
- self.complete (function() {
68
- self.view('homepage ', builder);
59
+ self.run (function() {
60
+ self.view('index ', builder);
69
61
});
70
62
71
63
or ...
@@ -74,5 +66,5 @@ function viewHomepage() {
74
66
if ( self . xhr )
75
67
self . jsonAsync ( builder ) ;
76
68
else
77
- self . viewAsync ( 'homepage ' , builder ) ;
69
+ self . viewAsync ( 'index ' , builder ) ;
78
70
}
0 commit comments