Mercurial > hg > ugly-duckling
annotate src/app/notebook-feed/notebook-feed.component.ts @ 232:77ada2e07997
Setup feed for OnPush strategy and pass single items to children
author | Lucas Thompson <dev@lucas.im> |
---|---|
date | Mon, 24 Apr 2017 16:39:32 +0100 |
parents | d179cf7df697 |
children | 53ea6406d601 |
rev | line source |
---|---|
dev@171 | 1 /** |
dev@171 | 2 * Created by lucast on 21/03/2017. |
dev@171 | 3 */ |
dev@232 | 4 import { |
dev@232 | 5 ChangeDetectionStrategy, |
dev@232 | 6 Component, |
dev@232 | 7 Input |
dev@232 | 8 } from "@angular/core"; |
dev@178 | 9 import Waves from 'waves-ui'; |
dev@201 | 10 import {AnalysisItem} from "../analysis-item/analysis-item.component"; |
dev@171 | 11 |
dev@171 | 12 @Component({ |
dev@171 | 13 selector: 'ugly-notebook-feed', |
dev@171 | 14 templateUrl: './notebook-feed.component.html', |
dev@232 | 15 styleUrls: ['./notebook-feed.component.css'], |
dev@232 | 16 changeDetection: ChangeDetectionStrategy.OnPush |
dev@171 | 17 }) |
dev@171 | 18 export class NotebookFeedComponent { |
dev@189 | 19 sharedTimeline: Timeline; |
dev@201 | 20 @Input() analyses: AnalysisItem[]; |
dev@201 | 21 @Input() set rootAudioUri(uri: string) { |
dev@201 | 22 this._rootAudioUri = uri; |
dev@171 | 23 |
dev@201 | 24 // TODO is this safe? will the fact references are held elsewhere |
dev@201 | 25 // keep the previous instance alive? Or will it get garbage collected in |
dev@201 | 26 // screw previous layers up? |
dev@201 | 27 this.sharedTimeline = new Waves.core.Timeline(); |
dev@171 | 28 } |
dev@171 | 29 |
dev@201 | 30 get rootAudioUri(): string { |
dev@201 | 31 return this._rootAudioUri; |
dev@171 | 32 } |
dev@201 | 33 private _rootAudioUri: string; |
dev@181 | 34 |
dev@181 | 35 constructor() { |
dev@189 | 36 this.sharedTimeline = new Waves.core.Timeline(); |
dev@181 | 37 } |
dev@171 | 38 } |