Last active
August 29, 2015 14:06
-
-
Save hysios/2e86cb0c1ad2acfdac59 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
import Ember from 'ember'; | |
var get = Ember.get; | |
export default Ember.Component.extend({ | |
didInsertElement: function(){ | |
Ember.$(document).bind('click', this.closeThis); | |
}, | |
closeThis: function(event) { | |
//... do somthing | |
}, | |
willDestroyElement: function() { | |
Ember.$(document).unbind('click', this.closeThis); | |
} | |
}); |
This file contains hidden or 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
import Ember from 'ember'; | |
var get = Ember.get; | |
export default Ember.Component.extend({ | |
didInsertElement: function(){ | |
Ember.$(document).bind('click', {_this: this}, this.closeThis); | |
}, | |
closeThis: function(event) { | |
var _this = event.data._this; | |
//... do somthing | |
}, | |
willDestroyElement: function() { | |
Ember.$(document).unbind('click', this.closeThis); | |
} | |
}); |
This file contains hidden or 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 get = Ember.get; | |
export default Ember.Component.extend({ | |
init: function(){ | |
this.closeWithThis = this.closeThis.bind(this); | |
}, | |
didInsertElement: function(){ | |
Ember.$(document).bind('click', this.closeWithThis); | |
}, | |
closeThis: function(event) { | |
var _this = event.data._this; | |
//... do somthing | |
}, | |
willDestroyElement: function() { | |
Ember.$(document).unbind('click', this.closeWithThis); | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment