PageRenderTime 51ms CodeModel.GetById 24ms RepoModel.GetById 0ms app.codeStats 0ms

/fe/app/scripts/controllers/root.js

https://github.com/robcolbert/puretech-purityone
JavaScript | 58 lines | 41 code | 7 blank | 10 comment | 1 complexity | 8555f628ba6c0531e7c5683ad7f2f793 MD5 | raw file
  1. // root.js (controller)
  2. // Copyright (C) 2014 Rob Colbert <rob.isConnected@gmail.com>
  3. // All Rights Reserved
  4. 'use strict';
  5. /**
  6. * @ngdoc controller
  7. * @name purityOneApp.controller:RootCtrl
  8. * @description
  9. * # RootCtrl
  10. * Implements the root controller for the application.
  11. */
  12. function RootCtrl($scope, PurityAudio, PurityPresentation) {
  13. PurityAudio.initialize(); // fire it up!
  14. function updateAudioEngine ( ) {
  15. PurityAudio.updateAnalysis();
  16. }
  17. PurityPresentation.addAnimator(updateAudioEngine);
  18. console.debug('root controller instantiated');
  19. $scope.onKeyDown = function ($event) {
  20. console.debug('onKeyDown', $event.keyCode);
  21. switch ($event.keyCode) {
  22. case 37: // Left
  23. console.debug('Left');
  24. break;
  25. case 38: // Up
  26. console.debug('Up');
  27. break;
  28. case 39: // Right
  29. console.debug('Right');
  30. break;
  31. case 40: // Down
  32. console.debug('Down');
  33. break;
  34. case 13: // Enter
  35. console.debug('Enter/Select');
  36. break;
  37. case 27: // Esc
  38. console.debug('Esc/Back');
  39. break;
  40. default:
  41. break;
  42. }
  43. };
  44. }
  45. RootCtrl.$inject = [
  46. '$scope',
  47. 'PurityAudio',
  48. 'PurityPresentation'
  49. ];
  50. angular.module('purityOneApp')
  51. .controller('RootCtrl', RootCtrl);