2014-07-13 01:04:16 +02:00
|
|
|
//// [selfInCallback.ts]
|
|
|
|
class C {
|
|
|
|
public p1 = 0;
|
|
|
|
public callback(cb:()=>void) {cb();}
|
|
|
|
public doit() {
|
|
|
|
this.callback(()=>{this.p1+1});
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
//// [selfInCallback.js]
|
|
|
|
var C = (function () {
|
|
|
|
function C() {
|
|
|
|
this.p1 = 0;
|
|
|
|
}
|
2015-02-07 05:03:24 +01:00
|
|
|
C.prototype.callback = function (cb) { cb(); };
|
2014-07-13 01:04:16 +02:00
|
|
|
C.prototype.doit = function () {
|
|
|
|
var _this = this;
|
2015-02-07 05:03:24 +01:00
|
|
|
this.callback(function () { _this.p1 + 1; });
|
2014-07-13 01:04:16 +02:00
|
|
|
};
|
|
|
|
return C;
|
|
|
|
})();
|