jam/test/hello-world.js

33 lines
627 B
JavaScript
Raw Normal View History

2024-08-27 00:15:41 +02:00
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()