source : default.js

  1. 'use strict';
  2. /**
  3. * This is the Crew Chief App.
  4. * It displays some extra information beside the {@link sra-pit-commander PitCommander} widget.
  5. * Be default, it will run in read-only mode and not send commands to the SIM.
  6. * See the PITCOMMANDSSIMCONTROLLER parameter below to change it.
  7. *
  8. * <img src="../apps/CrewChief/icon.png" />
  9. *
  10. * NOTE: All parameters are specified in the URL.
  11. * @ngdoc apps
  12. * @name CrewChief
  13. * @param {boolean} PITCOMMANDSSIMCONTROLLER If true, then this widget can send changes to the SIM. Defaults to false.
  14. * @param {boolean} LAPSTOAVERAGE The number of laps to average for the fuel mileage commands. Defaults to zero(0) or worst lap.
  15. * @param {boolean} ALTLAPSTOAVERAGE The alternate number of laps to average for the fuel mileage commands. Used when saving fuel. Defaults to 2 laps.
  16. * @param {boolean} showFPS When any value is seen in the URL for this attribute, the Frames Per Second(FPS) will be shown. Defaults to not show.
  17. * @author Jeffrey Gilliam
  18. * @since 1.0
  19. * @copyright Copyright (C) 2015 - 2024 Jeffrey Gilliam
  20. * @license Apache License 2.0
  21. */
  22. require(SIMRacingAppsRequireConfig,
  23. ['angular'
  24. ,'SIMRacingApps'
  25. ,'css!default'
  26. ,'widgets/DataTable/DataTable'
  27. ,'widgets/WeatherInfo/WeatherInfo'
  28. ,'widgets/PitCommander/PitCommander'
  29. ,'widgets/CarNumber/CarNumber'
  30. ],
  31. function( angular, SIMRacingApps) {
  32. angular.element(document).ready(function() {
  33. //create any angular filters, values, constants, directives here on the SIMRacingApps.module
  34. //your application controller is added as a controller on the SIMRacingApps module
  35. SIMRacingApps.module.controller("SIMRacingApps-Controller",
  36. ['$scope','sraDispatcher',
  37. function($scope, sraDispatcher) {
  38. $scope.sraArgsLAPSTOAVERAGE = $scope.sraArgsLAPSTOAVERAGE || "0";
  39. $scope.sraArgsALTLAPSTOAVERAGE = $scope.sraArgsALTLAPSTOAVERAGE || "2";
  40. sraDispatcher.loadTranslations("/SIMRacingApps/apps/CrewChief","text",function(path) {
  41. $scope.translations = sraDispatcher.getTranslation(path,"auto");
  42. });
  43. }]);
  44. //now start the process by passing in the element where the SIMRacingsApps class is defined.
  45. //all elements below that will be owned by SIMRacingApps. This should allow you to put other
  46. //content outside of this element that is not SIMRacingApps specific. All bundled apps will pass in the body.
  47. SIMRacingApps.start(angular.element(document.body),800,480,16);
  48. //once angular is booted, your controller will get called.
  49. //it is not recommended to have multiple controllers in SIMRacingApps because of how the $scope is transversed from child to parent.
  50. //You can have as many directives and other angular objects as you wish.
  51. });
  52. });