Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Views API #53

Closed
thom4parisot opened this issue Jun 27, 2014 · 1 comment
Closed

Views API #53

thom4parisot opened this issue Jun 27, 2014 · 1 comment

Comments

@thom4parisot
Copy link
Contributor

thom4parisot commented Jun 27, 2014

Peaks should provide an easier way to add, remove and order views.

Using native views with default settings:

peaks.init({
  views: ['zoom', 'overview']
});

Using only one configured native views:

require(['peaks', 'peaks/views/zoom'], function(Peaks, ZoomView){
  var zoom = new ZoomView({
    height: 240,
    backgroundColor: '#fff',
    textColor: 'red'
  });

  var p = Peaks.init({
    views: [zoom]
  });
});

Combining a default native view and your custom metadata view:

require(['peaks', 'my/html/view'], function(Peaks, CustomView){
  var tableView = new CustomView({
    speakersDataUrl: '//localhost:3000/speakers/worldcup/france-vs-switzerland.json'
  });

  var p = Peaks.init({
    views: [tableView, 'overview']
  });
});

View

A view is an asynchronous renderer, performing actions based on peaks timed interactions.

var ZoomView = Object.create(BaseView.prototype, {
  id: 'zoom',
  init: function(config, peaks){
    peaks.on('segment.add', this.onAddSegment.bind(this);

    peaks.emit('load.views.' + id, this);
  },

  onAddSegment: function(segment){

  },

  timeUpdate: function(time){

  },

  render: function(){

  }
});

closes #2
closes #46
closes #59

@chrisn
Copy link
Member

chrisn commented Jun 22, 2019

This is resolved in release 0.10.0, please see the demo folder for examples.

@chrisn chrisn closed this as completed Jun 22, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants