-
-
Save Serabe/bb4338ab71e95ea7f361d0932857ee96 to your computer and use it in GitHub Desktop.
Component Lifecycle Mut
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'; | |
| export default Ember.Component.extend({ | |
| init() { | |
| this._super(...arguments); | |
| console.log('\ninit', this.get('vInit')); | |
| this.set('vInit', 99); | |
| }, | |
| didReceiveAttrs() { | |
| this._super(...arguments); | |
| console.log('\ndidReceiveAttrs', this.get('vDidReceiveAttrs')); | |
| this.set('vDidReceiveAttrs', 99); | |
| }, | |
| willRender() { | |
| this._super(...arguments); | |
| console.log('\nwillRender', this.get('vWillRender')); | |
| this.set('vWillRender', 99); | |
| }, | |
| didInsertElement() { | |
| this._super(...arguments); | |
| //console.log('\ndidInsertElement', this.get('vDidInsertElement')); | |
| //this.set('vDidInsertElement', 99); | |
| }, | |
| actions: { | |
| inc(prop) { | |
| this.incrementProperty(prop); | |
| } | |
| } | |
| }); |
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'; | |
| const { | |
| Controller, | |
| observer | |
| } = Ember; | |
| export default Controller.extend({ | |
| appName: 'Ember Twiddle', | |
| vInit: 1, | |
| vDidReceiveAttrs: 2, | |
| vWillRender: 3, | |
| vDidInsertElement: 4, | |
| oInit: observer('vInit', function() { | |
| console.log('init changed value', this.get('vInit')); | |
| }), | |
| oDidReceiveAttrs: observer('vDidReceiveAttrs', function() { | |
| console.log('didReceiveAttrs changed value', this.get('vDidReceiveAttrs')); | |
| }), | |
| oWillRender: observer('vWillRender', function() { | |
| console.log('willRender changed value', this.get('vWillRender')); | |
| }), | |
| oDidInsertElement: observer('vDidInsertElement', function() { | |
| console.log('didInsertElement changed value', this.get('vDidInsertElement')); | |
| }) | |
| }); |
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
| { | |
| "version": "0.10.1", | |
| "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.6.0", | |
| "ember-data": "2.6.1", | |
| "ember-template-compiler": "2.6.0" | |
| }, | |
| "addons": {} | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment