Skip to content

Commit 2f08b8e

Browse files
author
Suchita Doshi
committed
update readme
1 parent 28576ce commit 2f08b8e

File tree

1 file changed

+50
-15
lines changed

1 file changed

+50
-15
lines changed

transforms/tracked-properties/README.md

Lines changed: 50 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,14 @@ npx ember-tracked-properties-codemod path/of/files/ or/some**/*glob.hbs
99
## Input / Output
1010

1111
<!--FIXTURES_TOC_START-->
12-
* [basic](#basic)
13-
* [chained-complex-computed](#chained-complex-computed)
14-
* [chained-computed](#chained-computed)
15-
* [complex](#complex)
16-
* [with-tracked](#with-tracked)
17-
<!--FIXTURES_TOC_END-->
12+
13+
- [basic](#basic)
14+
- [basic-with-prefix-false](#basic-with-prefix-false)
15+
- [chained-complex-computed](#chained-complex-computed)
16+
- [chained-computed](#chained-computed)
17+
- [complex](#complex)
18+
- [with-tracked](#with-tracked)
19+
<!--FIXTURES_TOC_END-->
1820

1921
## <!--FIXTURES_CONTENT_START-->
2022

@@ -44,6 +46,44 @@ import { tracked } from '@glimmer/tracking';
4446
import Component from '@ember/component';
4547
import { computed, get } from '@ember/object';
4648

49+
export default class Foo extends Component {
50+
bar;
51+
@tracked baz = 'barBaz';
52+
53+
get bazInfo() {
54+
return `Name: ${get(this, 'baz')}`;
55+
}
56+
}
57+
```
58+
59+
---
60+
61+
<a id="basic-with-prefix-false">**basic-with-prefix-false ({alwaysPrefix: `false`})**</a>
62+
63+
**Input** (<small>[basic-with-prefix-false.input.js](__testfixtures__/basic-with-prefix-false.input.js)</small>):
64+
65+
```js
66+
import Component from '@ember/component';
67+
import { computed, get } from '@ember/object';
68+
69+
export default class Foo extends Component {
70+
bar;
71+
baz = 'barBaz';
72+
73+
@computed('baz')
74+
get bazInfo() {
75+
return `Name: ${get(this, 'baz')}`;
76+
}
77+
}
78+
```
79+
80+
**Output** (<small>[basic-with-prefix-false.output.js](__testfixtures__/basic-with-prefix-false.output.js)</small>):
81+
82+
```js
83+
import { tracked } from '@glimmer/tracking';
84+
import Component from '@ember/component';
85+
import { computed, get } from '@ember/object';
86+
4787
export default class Foo extends Component {
4888
bar;
4989
@tracked
@@ -91,8 +131,7 @@ import Component from '@ember/component';
91131
import { computed, get } from '@ember/object';
92132

93133
export default class Foo extends Component {
94-
@tracked
95-
firstName = 'Foo';
134+
@tracked firstName = 'Foo';
96135
@tracked lastName;
97136
@tracked phone;
98137
zipcode;
@@ -147,8 +186,7 @@ import Component from '@ember/component';
147186
import { computed, get } from '@ember/object';
148187

149188
export default class Foo extends Component {
150-
@tracked
151-
foo = 'bar';
189+
@tracked foo = 'bar';
152190
baz;
153191

154192
get fooBar() {
@@ -250,7 +288,6 @@ export default class Foo extends Component {
250288
return `Name: ${get(this, 'baz')}`;
251289
}
252290
}
253-
254291
```
255292

256293
**Output** (<small>[with-tracked.output.js](__testfixtures__/with-tracked.output.js)</small>):
@@ -262,14 +299,12 @@ import { computed, get } from '@ember/object';
262299

263300
export default class Foo extends Component {
264301
@tracked bar;
265-
@tracked
266-
baz = 'barBaz';
302+
@tracked baz = 'barBaz';
267303

268304
get bazInfo() {
269305
return `Name: ${get(this, 'baz')}`;
270306
}
271307
}
272-
273308
```
274309

275-
---
310+
---

0 commit comments

Comments
 (0)