File tree Expand file tree Collapse file tree 3 files changed +28
-12
lines changed Expand file tree Collapse file tree 3 files changed +28
-12
lines changed Original file line number Diff line number Diff line change @@ -22,22 +22,22 @@ import Ember from 'ember';
2222 ```
2323
2424 By default, the executed function will be unbound. If you would like to access
25- the component context in your function, use the `action` helper as follows:
25+ the component context in your function, use the `action` decorator as follows:
2626
2727 ```handlebars
28- <div {{did-insert (action this.incrementCount) }}>first</div>
29- <div {{did-insert (action this.incrementCount) }}>second</div>
28+ <div {{did-insert this.incrementCount}}>first</div>
29+ <div {{did-insert this.incrementCount}}>second</div>
3030
3131 <p>{{this.count}} elements were rendered</p>
3232 ```
3333
34- ```js
34+ ```js
3535 export default Component.extend({
36- @tracked count = 0;
36+ count: tracked({ value: 0 }),
3737
38- incrementCount() {
38+ incrementCount: action(function () {
3939 this.count++;
40- }
40+ })
4141 });
4242 ```
4343
Original file line number Diff line number Diff line change @@ -39,10 +39,18 @@ import Ember from 'ember';
3939 ```
4040
4141 By default, the executed function will be unbound. If you would like to access
42- the component context in your function, use the `action` helper as follows:
42+ the component context in your function, use the `action` decorator as follows:
4343
4444 ```handlebars
45- <div {{did-update (action this.someFunction) @someArg } />
45+ <div {{did-update this.someFunction @someArg } />
46+ ```
47+
48+ ```js
49+ export default Component.extend({
50+ someFunction: action(function(element, [someArg]) {
51+ // the `this` context will be the component instance
52+ })
53+ });
4654 ```
4755
4856 @method did-update
Original file line number Diff line number Diff line change @@ -19,14 +19,22 @@ import Ember from 'ember';
1919 ```
2020
2121 By default, the executed function will be unbound. If you would like to access
22- the component context in your function, use the `action` helper as follows:
22+ the component context in your function, use the `action` decorator as follows:
2323
24- ```handlebars
25- <div {{will-destroy (action this.teardownPlugin) }}>
24+ ```handlebars
25+ <div {{will-destroy this.teardownPlugin}}>
2626 {{yield}}
2727 </div>
2828 ```
2929
30+ ```js
31+ export default Component.extend({
32+ teardownPlugin: action(function(element) {
33+ // the `this` context will be the component instance
34+ })
35+ });
36+ ```
37+
3038 @method will-destroy
3139 @public
3240*/
You can’t perform that action at this time.
0 commit comments