Skip to content

PieLabs/pie-controller

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

48 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

pie-controller

A controller for a pie player.

It calls the underlying element-specific controller based on the id and pie.name in the data model.

usage

  
  import PieController from 'pie-controller';
  
  var controllerMap = {
    'pie-element' : pieElementController
  };

  var model = {
    pies: [
      { 
        id: '1', 
        element: 'pie-element'
      }
    ],
    langs: ['en-US'],
    weights: [{id: '1', weight: '1'}]
  }

  var controller = new PieController(model, controllerMap);
	
  /**
   * @param ids - an array of ids
   * @param sessions - an array of session data
   * @param env - the env 
   */
  controller.model(['1'], [{id: '1', ...}], {})
    .then((results) => {
      console.log(results);
    });

Browser Integration

This package exports an es6 module, if you want to use it in the browser you'll have to include it in a build tool like webpack and babel.

Test

npm test 

Release

npm run release