j言語----like Java v 2
1336 ワード
これはJava言語に似ています.
実装コード:
より完全なコード:
http://openxtiger.iteye.com/blog/1728643
'package jui'
.j(function() {
'import j.unit.Observable'.j();
'class Component'
.j({
constructor:function() {
},
show:function() {
console.log("Component");
}
});
'class Container extends Component implements Observable'
.j(function(jsuper, ob) {
return {
jstatic:{
a:1
},
constructor:function() {
var jthis = this;
jsuper.constructor.call(this);
ob.constructor.call(this);
console.dir(jthis.constructor.a);
}
}
});
});
実装コード:
String.prototype.j = function() {
var code;
if (arguments.length == 1) {
code = arguments[0];
return j(this.toString(), code);
}
return j(this.toString());
};
より完全なコード:
http://openxtiger.iteye.com/blog/1728643