From d6463b1e2fdcf346a30012db3f308043b1cfb459 Mon Sep 17 00:00:00 2001 From: Brian Ford Date: Thu, 16 Oct 2014 17:59:02 -0700 Subject: [PATCH] style(hintApp): move decls to top of file --- hintApp.js | 39 ++++++++++++++++++--------------------- 1 file changed, 18 insertions(+), 21 deletions(-) diff --git a/hintApp.js b/hintApp.js index df97d6a..23ea78b 100644 --- a/hintApp.js +++ b/hintApp.js @@ -1,8 +1,24 @@ +'use strict'; + angular.module('ngHintUI', []). + controller('HintController', ['$scope', 'hintService', HintController]). + service('hintService', ['$rootScope', hintService]); + +function HintController($scope, hintService) { + resetMessageData(); -controller('HintController', ['$scope', 'hintService', HintController]). + hintService.onRefresh(resetMessageData); -service('hintService', ['$rootScope', function($rootScope) { + function resetMessageData() { + $scope.hints = []; + } + + hintService.onHint(function(hint) { + $scope.hints.push(hint); + }); +} + +function hintService($rootScope) { var onHintCallback, onRefreshCallback; @@ -30,23 +46,4 @@ service('hintService', ['$rootScope', function($rootScope) { port.onDisconnect.addListener(function (a) { console.log(a); }); - -}]); - -function HintController($scope, hintService) { - - resetMessageData(); - - // TODO: rename this ? - hintService.onRefresh(resetMessageData); - - function resetMessageData() { - $scope.hints = []; - } - - //Set the hint service to perform this action whenever - //a new hint message is received. - hintService.onHint(function(hint) { - $scope.hints.push(hint); - }); }