Jellyvision/marker

View on GitHub
app/scripts/components/container/main.js

Summary

Maintainability
A
0 mins
Test Coverage
define([

  'lateralus'

  ,'marker.component.buffer'
  ,'marker.component.rendered-output'

  ,'./view'
  ,'text!./template.mustache'

], function (

  Lateralus

  ,BufferComponent
  ,RenderedOutputComponent

  ,View
  ,template

) {
  'use strict';

  /**
   * A suggested pattern for Lateralus apps is to have a single container
   * component that contains all other UI components within the application.
   * This component should be concerned with top-level presentation logic.
   */
  var ContainerComponent = Lateralus.Component.extend({
    name: 'container'
    ,View: View
    ,template: template

    // The container component's primary responsibility is to initialize other
    // subcomponents.
    ,initialize: function () {
      this.bufferComponent = this.addComponent(BufferComponent, {
        el: this.view.$buffer
      });

      this.renderedOutputComponent = this.addComponent(
          RenderedOutputComponent, {
        el: this.view.$renderedOutput
      });
    }
  });

  return ContainerComponent;
});