Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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);
}
});
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);
}
});
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
You can’t perform that action at this time.