Skip to content

Instantly share code, notes, and snippets.

@herecydev
Last active January 29, 2017 19:42
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save herecydev/294f1aedcf1bc3a58fc80652f8e68b79 to your computer and use it in GitHub Desktop.
Save herecydev/294f1aedcf1bc3a58fc80652f8e68b79 to your computer and use it in GitHub Desktop.
declare type DataReceived = (data: any) => void;
class Connection {
constructor() {
let thisHubConnection = this;
this.dataReceived = data => {
this.log(data);
thisHubConnection.log(data);
};
this.dataReceived("foo");
}
private dataReceived : DataReceived
private log(data: any) {
console.log(data);
}
}
let bar = new Connection();
var Connection = (function () {
function Connection() {
var _this = this;
var thisHubConnection = this;
this.dataReceived = function (data) {
_this.log(data);
thisHubConnection.log(data);
};
this.dataReceived("foo");
}
Connection.prototype.log = function (data) {
console.log(data);
};
return Connection;
}());
var bar = new Connection();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment