11exports . install = function ( framework ) {
2- framework . route ( '/' , viewHomepage , [ '+xhr' ] ) ;
2+ framework . route ( '/' , view_index ) ;
33} ;
44
5- function viewHomepage ( ) {
5+ function view_index ( ) {
6+
67 var self = this ;
78 var builder = [ ] ;
89
9- // Documentation: http://docs.totaljs.com/Async/
1010 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 ) {
1412 var output = err ? 'error' : data . length . toString ( ) ;
1513 builder . push ( 'www.google.com -> ' + output ) ;
1614 complete ( ) ;
1715 } ) ;
1816 } ) ;
1917
2018 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 ) {
2420 var output = err ? 'error' : data . length . toString ( ) ;
2521 builder . push ( 'www.expressjs.com -> ' + output ) ;
2622 complete ( ) ;
2723 } ) ;
2824 } ) ;
2925
3026 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 ) {
3428 var output = err ? 'error' : data . length . toString ( ) ;
3529 builder . push ( 'www.yahoo.com -> ' + output ) ;
3630 complete ( ) ;
3731 } ) ;
3832 } ) ;
3933
4034 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 ) {
4436 var output = err ? 'error' : data . length . toString ( ) ;
4537 builder . push ( 'www.totaljs.com -> ' + output ) ;
4638 complete ( ) ;
@@ -64,8 +56,8 @@ function viewHomepage() {
6456 } ) ;
6557
6658 /*
67- self.complete (function() {
68- self.view('homepage ', builder);
59+ self.run (function() {
60+ self.view('index ', builder);
6961 });
7062
7163 or ...
@@ -74,5 +66,5 @@ function viewHomepage() {
7466 if ( self . xhr )
7567 self . jsonAsync ( builder ) ;
7668 else
77- self . viewAsync ( 'homepage ' , builder ) ;
69+ self . viewAsync ( 'index ' , builder ) ;
7870}
0 commit comments