diff --git a/addon/components/flexi-sustain.js b/addon/components/flexi-sustain.js index eb47bf2..006e117 100644 --- a/addon/components/flexi-sustain.js +++ b/addon/components/flexi-sustain.js @@ -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'); diff --git a/tests/dummy/app/routes/docs/sustain/template.hbs b/tests/dummy/app/routes/docs/sustain/template.hbs index 75a69ff..df38ee6 100644 --- a/tests/dummy/app/routes/docs/sustain/template.hbs +++ b/tests/dummy/app/routes/docs/sustain/template.hbs @@ -19,7 +19,7 @@

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.

This produces a significant performance advantage by allowing you to seamlessly restructure your @@ -50,6 +50,15 @@ live forever.

{{code-snippet name='sustain-5.hbs'}} + +

Labeling a sustain

+

+ 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. +

+ {{code-snippet name='sustain-6.hbs'}} + @@ -75,4 +84,8 @@ {{sustain 'foo-component' expires=0}} {{-- END-SNIPPET +{{!-- BEGIN-SNIPPET sustain-6 +{{sustain 'foo-component' model label="a-key"}} +{{-- END-SNIPPET + --}} \ No newline at end of file