refactored. Renamed services for clarity

This commit is contained in:
Nils Norman Haukås 2015-11-14 13:41:51 +01:00
parent c07f62428c
commit f44177a938
4 changed files with 16 additions and 16 deletions

View file

@ -1,14 +1,14 @@
/// <reference path="../typings/tsd.d.ts" />
/// <reference path="menu/menu.controller.ts" />
/// <reference path="services/data.service.ts" />
/// <reference path="services/selectedWord.service.ts" />
/// <reference path="services/backend.service.ts" />
/// <reference path="services/webPage.service.ts" />
module tagIt {
angular.module('tagit', [])
.service('DataService', DataService)
.service('SelectedWordService', SelectedWordService)
.service('BackendService', BackendService)
.service('WebPageService', WebPageService)
.controller('MenuCtrl', MenuCtrl);
export function init (callback: () => void) {

View file

@ -7,20 +7,20 @@ module tagIt {
selectedWord = "";
senses : Object[];
dataService : DataService;
selectedWordService : SelectedWordService;
backendService : BackendService;
selectedWordService : WebPageService;
$log : ng.ILogService;
$scope: ng.IScope;
/* @ngInject */
constructor ($scope: IVMScope, $log: angular.ILogService,
DataService: DataService,
SelectedWordService: SelectedWordService) {
BackendService: BackendService,
WebPageService: WebPageService) {
$scope.vm = this;
this.$log = $log;
this.$scope = $scope;
this.dataService = DataService;
this.selectedWordService = SelectedWordService;
this.backendService = BackendService;
this.selectedWordService = WebPageService;
// Wire up clicklistener
this.selectedWordService.wireUpListener(this.onWordSelected,
@ -29,15 +29,15 @@ module tagIt {
onTagSelect (sense: ISense) {
this.selectedWordService.addTagToPage(sense);
this.dataService.storeTaggingInformation({});
this.backendService.storeTaggingInformation({});
}
onWordSelected = (newWord : string) => {
this.selectedWord = newWord;
this.dataService.callServer(newWord)
this.backendService.callServer(newWord)
.then((synsets : Object) => {
this.$log.debug(synsets);
this.senses = this.dataService.processSynsets(<ISynset> synsets);
this.senses = this.backendService.processSynsets(<ISynset> synsets);
});
}
@ -49,7 +49,7 @@ module tagIt {
}
selectWord (sense : ISense) {
this.dataService.storeTaggingInformation({
this.backendService.storeTaggingInformation({
mail: "mail@nilsnh.no",
sentence: "whole sentence",
senseid: sense.senseid,

View file

@ -4,7 +4,7 @@
module tagIt {
export class DataService {
export class BackendService {
$http : ng.IHttpService;
$log : ng.ILogService;

View file

@ -5,7 +5,7 @@ module tagIt {
* Takes care of figuring out what word
* is selected.
*/
export class SelectedWordService {
export class WebPageService {
$log : ng.ILogService;
currentSelectionRange : any;