Last active
December 6, 2015 11:16
-
-
Save benjaminRomano/2fc45eb4f3ba9303524c 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
class example | |
constructor() -> | |
@leftPanel = 5 | |
#This is bad | |
@deletePaneCallback:(id) -> | |
console.log 'leftPane:' + @leftPanel #This will be undefined | |
#this is good | |
@deletePaneCallback2: (id) => | |
cosole.log 'leftPane:' + @leftPanel # This will be 5 | |
@consumeBottomDock: (@bottomDock) -> | |
@bottomDock.onDidDeletePane @deletePaneCallback | |
@bottomDock.onDidDeletePane @deletePaneCallback2 | |
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 example = function() { | |
this.leftPanel = 5; | |
this.deletePaneCallback(id) { | |
console.log('leftPanel:' + this.leftPanel); //This will be undefined | |
} | |
this.consumeBottomDock: (@bottomDock) -> | |
//This is the same as @deletePaneCallback | |
this.bottomDock.onDidDeletePane(this.deletePaneCallback); //This will be undefined | |
//This is the same as @deleteCallback2 | |
this.bottomDock.onDidDeletePane(this.deletePaneCallback.bind(this)); //This will be 5 | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment