Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adds documentation for labels and namespaces them #28

Merged
merged 2 commits into from
Mar 16, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions addon/components/flexi-sustain.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@ const component = Component.extend({

if (!this.label) {
this.label = this.component;
} else {
this.label = `${this.component}:${this.label}`;
}

let properties = this.getProperties('label', 'component', 'model', 'copy', 'expires');
Expand Down
15 changes: 14 additions & 1 deletion tests/dummy/app/routes/docs/sustain/template.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
</p>
<p>
Since the component a sustain specifies is moved from marker to marker, only one marker instance
for a given component name can be used at a time (Coming Soon: 1.1 will allow multiple named instances).
for a given component name can be used at a time, unless a unique label is provided.
</p>
<p>
This produces a significant performance advantage by allowing you to seamlessly restructure your
Expand Down Expand Up @@ -50,6 +50,15 @@
live forever.
</p>
{{code-snippet name='sustain-5.hbs'}}

<h3>Labeling a sustain</h3>
<p>
If you need more than one instance of a component to be recycleable, you may provide a unique label
for the sustain. The instance will only be reused in locations where that label appears in conjunction
with the same Component Name.
</p>
{{code-snippet name='sustain-6.hbs'}}

</box>
</box>

Expand All @@ -75,4 +84,8 @@
{{sustain 'foo-component' expires=0}}
{{-- END-SNIPPET

{{!-- BEGIN-SNIPPET sustain-6
{{sustain 'foo-component' model label="a-key"}}
{{-- END-SNIPPET

--}}