mirror of
https://github.com/discourse/discourse.git
synced 2025-02-25 18:55:32 -06:00
DEV: adds teardownComponent hook to connector class (#8171)
This is the counterpart to setupComponent and allows you to clean any observers or state when the component is destroyed.
This commit is contained in:
parent
061b98bc75
commit
49a4b0dd9c
@ -16,6 +16,13 @@ export default Ember.Component.extend({
|
||||
this.set("actions", connectorClass.actions);
|
||||
},
|
||||
|
||||
willDestroyElement() {
|
||||
this._super(...arguments);
|
||||
|
||||
const connectorClass = this.get("connector.connectorClass");
|
||||
connectorClass.teardownComponent.call(this, this);
|
||||
},
|
||||
|
||||
@observes("args")
|
||||
_argsChanged() {
|
||||
const args = this.args || {};
|
||||
|
@ -17,7 +17,8 @@ export function extraConnectorClass(name, obj) {
|
||||
const DefaultConnectorClass = {
|
||||
actions: {},
|
||||
shouldRender: () => true,
|
||||
setupComponent() {}
|
||||
setupComponent() {},
|
||||
teardownComponent() {}
|
||||
};
|
||||
|
||||
function findOutlets(collection, callback) {
|
||||
|
Loading…
Reference in New Issue
Block a user