Last active
January 2, 2017 17:58
-
-
Save kybishop/3ca76407c810fb0c6b066c638cc2e1e8 to your computer and use it in GitHub Desktop.
Can't cancel task
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
import Ember from 'ember'; | |
export default Ember.Component.extend({ | |
didInsertElement() { | |
this._super(...arguments); | |
console.log('in didInsertElement'); | |
console.log("element: "); | |
console.log(this.get('element')); | |
let afterRenderHandler = Ember.run.schedule('afterRender', () => { | |
console.log('in afterRender'); | |
console.log("is destroying: " + this.get('isDestroying')); | |
console.log("is destroyed: " + this.get('isDestroyed')); | |
console.log("element in afterRender: "); | |
console.log(this.get('element')); | |
}); | |
this.set('afterRenderHandler', afterRenderHandler); | |
}, | |
willDestroyElement() { | |
this._super(...arguments); | |
console.log('in willDestroyElement'); | |
console.log('element in willDestroyElement'); | |
console.log(this.get('element')); | |
Ember.run.cancel(this.get('afterRenderHandler')); | |
} | |
}); |
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
import Ember from 'ember'; | |
export default Ember.Component.extend({ | |
sharedService: Ember.inject.service(), | |
didInsertElement() { | |
this._super(...arguments); | |
console.log('mutating shared service'); | |
this.set('sharedService.showDestroyedComponent', false); | |
} | |
}); |
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
import Ember from 'ember'; | |
export default Ember.Controller.extend({ | |
sharedService: Ember.inject.service(), | |
actions: { | |
toggleTest() { | |
this.toggleProperty('sharedService.show'); | |
this.toggleProperty('sharedService.showDestroyedComponent'); | |
} | |
} | |
}); |
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
{ | |
"version": "0.10.7", | |
"EmberENV": { | |
"FEATURES": {} | |
}, | |
"options": { | |
"use_pods": false, | |
"enable-testing": false | |
}, | |
"dependencies": { | |
"jquery": "https://cdnjs.cloudflare.com/ajax/libs/jquery/1.11.3/jquery.js", | |
"ember": "2.5.1", | |
"ember-template-compiler": "2.5.1", | |
"ember-testing": "2.5.1" | |
}, | |
"addons": {} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment