Last active
January 29, 2017 19:42
-
-
Save herecydev/294f1aedcf1bc3a58fc80652f8e68b79 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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