Last active
January 20, 2021 04:47
-
-
Save Subtletree/1e33184eeaf1f5e745a8d3940026f958 to your computer and use it in GitHub Desktop.
Nested component hooks
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({ | |
number: 0, | |
actions: { | |
inc() { | |
this.incrementProperty('number'); | |
} | |
}, | |
init() { | |
this._super(...arguments); | |
console.log('%c Child: init', 'color: blue;'); | |
}, | |
didUpdateAttrs() { | |
this._super(...arguments); | |
console.log('%c Child: didUpdateAttrs', 'color: blue;'); | |
}, | |
didReceiveAttrs() { | |
this._super(...arguments); | |
console.log('%c Child: didReceiveAttrs', 'color: blue;'); | |
}, | |
willUpdate() { | |
this._super(...arguments); | |
console.log('%c Child: willUpdate', 'color: blue;'); | |
}, | |
willRender() { | |
this._super(...arguments); | |
console.log('%c Child: willRender', 'color: blue;'); | |
}, | |
didInsertElement() { | |
this._super(...arguments); | |
console.log('%c Child: didInsertElement', 'color: blue;'); | |
}, | |
didUpdate() { | |
this._super(...arguments); | |
console.log('%c Child: didUpdate', 'color: blue;'); | |
}, | |
didRender() { | |
this._super(...arguments); | |
console.log('%c Child: didRender', 'color: blue;'); | |
} | |
}); |
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({ | |
number: 0, | |
actions: { | |
inc() { | |
this.incrementProperty('number'); | |
} | |
}, | |
init() { | |
this._super(...arguments); | |
console.log('%c Grandchild: init', 'color: orange;'); | |
}, | |
didUpdateAttrs() { | |
this._super(...arguments); | |
console.log('%c Grandchild: didUpdateAttrs', 'color: orange;'); | |
}, | |
didReceiveAttrs() { | |
this._super(...arguments); | |
console.log('%c Grandchild: didReceiveAttrs', 'color: orange;'); | |
}, | |
willUpdate() { | |
this._super(...arguments); | |
console.log('%c Grandchild: willUpdate', 'color: orange;'); | |
}, | |
willRender() { | |
this._super(...arguments); | |
console.log('%c Grandchild: willRender', 'color: orange;'); | |
}, | |
didInsertElement() { | |
this._super(...arguments); | |
console.log('%c Grandchild: didInsertElement', 'color: orange;'); | |
}, | |
didUpdate() { | |
this._super(...arguments); | |
console.log('%c Grandchild: didUpdate', 'color: orange;'); | |
}, | |
didRender() { | |
this._super(...arguments); | |
console.log('%c Grandchild: didRender', 'color: orange;'); | |
} | |
}); |
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({ | |
number: 0, | |
showChild: true, | |
actions: { | |
inc() { | |
this.incrementProperty('number'); | |
} | |
}, | |
init() { | |
this._super(...arguments); | |
console.log('%c Parent: init', 'color: green;'); | |
}, | |
didUpdateAttrs() { | |
this._super(...arguments); | |
console.log('%c Parent: didUpdateAttrs', 'color: green;'); | |
}, | |
didReceiveAttrs() { | |
this._super(...arguments); | |
console.log('%c Parent: didReceiveAttrs', 'color: green;'); | |
}, | |
willUpdate() { | |
this._super(...arguments); | |
console.log('%c Parent: willUpdate', 'color: green;'); | |
}, | |
willRender() { | |
this._super(...arguments); | |
console.log('%c Parent: willRender', 'color: green;'); | |
}, | |
didInsertElement() { | |
this._super(...arguments); | |
console.log('%c Parent: didInsertElement', 'color: green;'); | |
}, | |
didUpdate() { | |
this._super(...arguments); | |
console.log('%c Parent: didUpdate', 'color: green;'); | |
}, | |
didRender() { | |
this._super(...arguments); | |
console.log('%c Parent: didRender', 'color: green;'); | |
} | |
}); |
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({ | |
appName: 'Nested component hooks' | |
}); |
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.17.1", | |
"EmberENV": { | |
"FEATURES": {}, | |
"_TEMPLATE_ONLY_GLIMMER_COMPONENTS": false, | |
"_APPLICATION_TEMPLATE_WRAPPER": true, | |
"_JQUERY_INTEGRATION": true | |
}, | |
"options": { | |
"use_pods": false, | |
"enable-testing": false | |
}, | |
"dependencies": { | |
"jquery": "https://cdnjs.cloudflare.com/ajax/libs/jquery/3.5.1/jquery.js", | |
"ember": "3.18.1", | |
"ember-template-compiler": "3.18.1", | |
"ember-testing": "3.18.1" | |
}, | |
"addons": { | |
"@glimmer/component": "1.0.0" | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment