Skip to content

Commit

Permalink
Merge pull request #28 from runspired/feat/sustain-labels
Browse files Browse the repository at this point in the history
Adds documentation for labels and namespaces them
  • Loading branch information
runspired committed Mar 16, 2016
2 parents 9b9f378 + a26496c commit 0db6c19
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 1 deletion.
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
--}}

0 comments on commit 0db6c19

Please sign in to comment.