소스 검색

refactor: Rewrite HsComponent to class

jmacura 5 년 전
부모
커밋
7a322f8317
1개의 변경된 파일29개의 추가작업 그리고 24개의 파일을 삭제
  1. 29 24
      src/app.component.ts

+ 29 - 24
src/app.component.ts

@@ -10,24 +10,29 @@ export const HsComponent = {
     return HsCore.hslayersNgTemplate;
   },
   bindings: {},
-  controller: function (
-    gettext,
-    HsCore,
-    HsLayoutService,
-    HsSidebarService,
-    AdjusterService,
-    AppService
-  ) {
-    'ngInject';
-    const vm = this;
-    vm.exists = HsCore.exists;
-    vm.panelVisible = HsLayoutService.panelVisible;
-    vm.PraAdjusterService = AdjusterService;
-    HsLayoutService.sidebarRight = false;
-    console.log(HsLayoutService.sidebarRight);
-    // HsLayoutService.sidebarToggleable = false;
-    // HsLayoutService.sidebarButtons = true;
-    /*$scope.$on('scope_loaded', function (event, args) {
+  controllerAs: 'vm',
+  controller: class HsComponent {
+    exists;
+    panelVisible;
+    PraAdjusterService;
+    constructor(
+      gettext,
+      HsCore,
+      HsLayoutService,
+      HsSidebarService,
+      AdjusterService,
+      AppService
+    ) {
+      'ngInject';
+      const vm = this;
+      vm.exists = HsCore.exists;
+      vm.panelVisible = HsLayoutService.panelVisible;
+      vm.PraAdjusterService = AdjusterService;
+      HsLayoutService.sidebarRight = false;
+      console.log(HsLayoutService.sidebarRight);
+      // HsLayoutService.sidebarToggleable = false;
+      // HsLayoutService.sidebarButtons = true;
+      /*$scope.$on('scope_loaded', function (event, args) {
       if (args === 'Sidebar') {
         const loader = angular.element(
           '<pra-adjuster-loader class="loader-splash" ng-if="vm.PraAdjusterService.isClusteringInProcess()"></pra-adjuster-loader>'
@@ -38,13 +43,13 @@ export const HsComponent = {
         $compile(loader)(event.targetScope);
       }
     });*/
-    AdjusterService.clustersLoaded.subscribe(() => {
-      colorPalette = generateRandomColorPalette(
-        AdjusterService.clusters.length
-      );
-    });
+      AdjusterService.clustersLoaded.subscribe(() => {
+        colorPalette = generateRandomColorPalette(
+          AdjusterService.clusters.length
+        );
+      });
+    }
   },
-  controllerAs: 'vm',
 };
 
 // https://colorbrewer2.org/?type=qualitative&scheme=Paired&n=12