/fe/app/scripts/controllers/root.js
JavaScript | 58 lines | 41 code | 7 blank | 10 comment | 1 complexity | 8555f628ba6c0531e7c5683ad7f2f793 MD5 | raw file
- // root.js (controller)
- // Copyright (C) 2014 Rob Colbert <rob.isConnected@gmail.com>
- // All Rights Reserved
- 'use strict';
- /**
- * @ngdoc controller
- * @name purityOneApp.controller:RootCtrl
- * @description
- * # RootCtrl
- * Implements the root controller for the application.
- */
- function RootCtrl($scope, PurityAudio, PurityPresentation) {
- PurityAudio.initialize(); // fire it up!
- function updateAudioEngine ( ) {
- PurityAudio.updateAnalysis();
- }
- PurityPresentation.addAnimator(updateAudioEngine);
- console.debug('root controller instantiated');
- $scope.onKeyDown = function ($event) {
- console.debug('onKeyDown', $event.keyCode);
- switch ($event.keyCode) {
- case 37: // Left
- console.debug('Left');
- break;
- case 38: // Up
- console.debug('Up');
- break;
- case 39: // Right
- console.debug('Right');
- break;
- case 40: // Down
- console.debug('Down');
- break;
- case 13: // Enter
- console.debug('Enter/Select');
- break;
- case 27: // Esc
- console.debug('Esc/Back');
- break;
- default:
- break;
- }
- };
- }
- RootCtrl.$inject = [
- '$scope',
- 'PurityAudio',
- 'PurityPresentation'
- ];
- angular.module('purityOneApp')
- .controller('RootCtrl', RootCtrl);