Tue 27 Aug 00:14:56 CEST 2024
This commit is contained in:
		
							parent
							
								
									a149213e1a
								
							
						
					
					
						commit
						3bef39f4f4
					
				
							
								
								
									
										32
									
								
								test/hello-world.js
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										32
									
								
								test/hello-world.js
									
									
									
									
									
										Normal file
									
								
							| 
						 | 
				
			
			@ -0,0 +1,32 @@
 | 
			
		|||
function hello(arg) {
 | 
			
		||||
  this.arg=arg;
 | 
			
		||||
  this.act = {
 | 
			
		||||
    main : function () {
 | 
			
		||||
      log('Hello',this.arg);
 | 
			
		||||
    },
 | 
			
		||||
    more : function () {
 | 
			
		||||
      log('World');
 | 
			
		||||
      // throw error
 | 
			
		||||
      function foo() {
 | 
			
		||||
        return {}.x()
 | 
			
		||||
      }
 | 
			
		||||
      // try { foo() } catch (e) { log(e.toString()) }
 | 
			
		||||
      foo()
 | 
			
		||||
    },
 | 
			
		||||
    end : function () {
 | 
			
		||||
      log('Terminate');
 | 
			
		||||
    }
 | 
			
		||||
  }
 | 
			
		||||
  this.trans = {
 | 
			
		||||
    main : more,
 | 
			
		||||
    more : end
 | 
			
		||||
  }
 | 
			
		||||
  this.on = {
 | 
			
		||||
    // w/o handler agent will be terminated on error
 | 
			
		||||
    error : function (err) { log('error',err,this.next) }
 | 
			
		||||
  }
 | 
			
		||||
  this.next='main';
 | 
			
		||||
}
 | 
			
		||||
compile(hello,{verbose:1});
 | 
			
		||||
create('hello','You')
 | 
			
		||||
start()
 | 
			
		||||
		Loading…
	
		Reference in New Issue
	
	Block a user