Skip to content

Commit

Permalink
Merge pull request #360 from tracked-tools/template-tag-import
Browse files Browse the repository at this point in the history
Add named export for template tag usage
  • Loading branch information
SergeAstapov authored Aug 21, 2024
2 parents 3069b7d + f929e7c commit d6b4d5e
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 0 deletions.
20 changes: 20 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,26 @@ Useful for scenarios where the *only* reason to have a backing class is to host

(For folks from outside Ember: it's just like `useState`, but via autotracking.)

For usage in [Template Tag Format](https://guides.emberjs.com/release/components/template-tag-format/),
this addon provides `track` named export:

```gjs
import { fn } from '@ember/helper';
import { on } from '@ember/modifier';
import { track } from 'ember-simple-track-helper';
export default <template>
{{#let (track false) as |toggle|}}
{{#unless toggle.value}}
<button {{on "click" (fn toggle.update true)}}>Show it!</button>
{{/unless}}
<MyModal
@isShowing={{toggle.value}}
@onClose={{fn toggle.update false}}
/>
{{/let}}
</template>
```

Compatibility
------------------------------------------------------------------------------
Expand Down
1 change: 1 addition & 0 deletions ember-simple-track-helper/src/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export { default as track } from './helpers/track.ts';

0 comments on commit d6b4d5e

Please sign in to comment.