view 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
line wrap: on
line source
/**
 * Created by lucast on 21/03/2017.
 */
import {
  ChangeDetectionStrategy,
  Component,
  Input
} from "@angular/core";
import Waves from 'waves-ui';
import {AnalysisItem} from "../analysis-item/analysis-item.component";

@Component({
  selector: 'ugly-notebook-feed',
  templateUrl: './notebook-feed.component.html',
  styleUrls: ['./notebook-feed.component.css'],
  changeDetection: ChangeDetectionStrategy.OnPush
})
export class NotebookFeedComponent {
  sharedTimeline: Timeline;
  @Input() analyses: AnalysisItem[];
  @Input() set rootAudioUri(uri: string) {
    this._rootAudioUri = uri;

    // TODO is this safe? will the fact references are held elsewhere
    // keep the previous instance alive? Or will it get garbage collected in
    // screw previous layers up?
    this.sharedTimeline = new Waves.core.Timeline();
  }

  get rootAudioUri(): string {
    return this._rootAudioUri;
  }
  private _rootAudioUri: string;

  constructor() {
    this.sharedTimeline = new Waves.core.Timeline();
  }
}