Change detection optimization

This commit is contained in:
Farkas József
2017-02-07 20:22:41 +01:00
parent 4031509acd
commit dd9ce4827f
14 changed files with 42 additions and 28 deletions

View File

@@ -1,4 +1,4 @@
import { Component, EventEmitter, Input, OnInit, Output } from '@angular/core'; import { Component, EventEmitter, Input, OnInit, Output, ChangeDetectionStrategy } from '@angular/core';
import { Module } from '../../../config-serializer/config-items/Module'; import { Module } from '../../../config-serializer/config-items/Module';
import { SvgModule } from '../module'; import { SvgModule } from '../module';
@@ -6,7 +6,8 @@ import { SvgModule } from '../module';
@Component({ @Component({
selector: 'svg-keyboard', selector: 'svg-keyboard',
templateUrl: './svg-keyboard.component.html', templateUrl: './svg-keyboard.component.html',
styleUrls: ['./svg-keyboard.component.scss'] styleUrls: ['./svg-keyboard.component.scss'],
changeDetection: ChangeDetectionStrategy.OnPush
}) })
export class SvgKeyboardComponent implements OnInit { export class SvgKeyboardComponent implements OnInit {
@Input() moduleConfig: Module[]; @Input() moduleConfig: Module[];

View File

@@ -1,8 +1,9 @@
import { Component, Input, OnInit } from '@angular/core'; import { Component, Input, OnInit, ChangeDetectionStrategy } from '@angular/core';
@Component({ @Component({
selector: 'g[svg-icon-text-key]', selector: 'g[svg-icon-text-key]',
templateUrl: './svg-icon-text-key.component.html' templateUrl: './svg-icon-text-key.component.html',
changeDetection: ChangeDetectionStrategy.OnPush
}) })
export class SvgIconTextKeyComponent implements OnInit { export class SvgIconTextKeyComponent implements OnInit {
@Input() width: number; @Input() width: number;

View File

@@ -1,4 +1,4 @@
import { Component, Input, OnChanges, OnInit } from '@angular/core'; import { Component, Input, OnChanges, OnInit, ChangeDetectionStrategy } from '@angular/core';
import { KeystrokeAction } from '../../../../config-serializer/config-items/key-action'; import { KeystrokeAction } from '../../../../config-serializer/config-items/key-action';
import { KeyModifiers } from '../../../../config-serializer/config-items/KeyModifiers'; import { KeyModifiers } from '../../../../config-serializer/config-items/KeyModifiers';
@@ -27,7 +27,8 @@ enum Modifiers {
@Component({ @Component({
selector: 'g[svg-keystroke-key]', selector: 'g[svg-keystroke-key]',
templateUrl: './svg-keystroke-key.component.html', templateUrl: './svg-keystroke-key.component.html',
styleUrls: ['./svg-keystroke-key.component.scss'] styleUrls: ['./svg-keystroke-key.component.scss'],
changeDetection: ChangeDetectionStrategy.OnPush
}) })
export class SvgKeystrokeKeyComponent implements OnInit, OnChanges { export class SvgKeystrokeKeyComponent implements OnInit, OnChanges {
@Input() height: number; @Input() height: number;

View File

@@ -1,10 +1,11 @@
import { Component, Input, OnInit } from '@angular/core'; import { Component, Input, OnInit, ChangeDetectionStrategy } from '@angular/core';
import { MapperService } from '../../../../services/mapper.service'; import { MapperService } from '../../../../services/mapper.service';
@Component({ @Component({
selector: 'g[svg-mouse-click-key]', selector: 'g[svg-mouse-click-key]',
templateUrl: './svg-mouse-click-key.html' templateUrl: './svg-mouse-click-key.html',
changeDetection: ChangeDetectionStrategy.OnPush
}) })
export class SvgMouseClickKeyComponent implements OnInit { export class SvgMouseClickKeyComponent implements OnInit {
@Input() button: string; @Input() button: string;

View File

@@ -1,10 +1,11 @@
import { Component, Input, OnChanges } from '@angular/core'; import { Component, Input, OnChanges, ChangeDetectionStrategy } from '@angular/core';
import { MouseAction, MouseActionParam } from '../../../../config-serializer/config-items/key-action'; import { MouseAction, MouseActionParam } from '../../../../config-serializer/config-items/key-action';
@Component({ @Component({
selector: 'g[svg-mouse-key]', selector: 'g[svg-mouse-key]',
templateUrl: './svg-mouse-key.html' templateUrl: './svg-mouse-key.html',
changeDetection: ChangeDetectionStrategy.OnPush
}) })
export class SvgMouseKeyComponent implements OnChanges { export class SvgMouseKeyComponent implements OnChanges {
@Input() mouseAction: MouseAction; @Input() mouseAction: MouseAction;

View File

@@ -1,10 +1,11 @@
import { Component, Input, OnChanges } from '@angular/core'; import { Component, Input, OnChanges, ChangeDetectionStrategy } from '@angular/core';
import { MapperService } from '../../../../services/mapper.service'; import { MapperService } from '../../../../services/mapper.service';
@Component({ @Component({
selector: 'g[svg-mouse-move-key]', selector: 'g[svg-mouse-move-key]',
templateUrl: './svg-mouse-move-key.html' templateUrl: './svg-mouse-move-key.html',
changeDetection: ChangeDetectionStrategy.OnPush
}) })
export class SvgMouseMoveKeyComponent implements OnChanges { export class SvgMouseMoveKeyComponent implements OnChanges {
@Input() direction: string; @Input() direction: string;

View File

@@ -1,10 +1,11 @@
import { Component, Input, OnChanges } from '@angular/core'; import { Component, Input, OnChanges, ChangeDetectionStrategy } from '@angular/core';
import { MapperService } from '../../../../services/mapper.service'; import { MapperService } from '../../../../services/mapper.service';
@Component({ @Component({
selector: 'g[svg-mouse-scroll-key]', selector: 'g[svg-mouse-scroll-key]',
templateUrl: './svg-mouse-scroll-key.html' templateUrl: './svg-mouse-scroll-key.html',
changeDetection: ChangeDetectionStrategy.OnPush
}) })
export class SvgMouseScrollKeyComponent implements OnChanges { export class SvgMouseScrollKeyComponent implements OnChanges {
@Input() direction: string; @Input() direction: string;

View File

@@ -1,10 +1,11 @@
import { Component, Input, OnChanges } from '@angular/core'; import { Component, Input, OnChanges, ChangeDetectionStrategy } from '@angular/core';
import { MapperService } from '../../../../services/mapper.service'; import { MapperService } from '../../../../services/mapper.service';
@Component({ @Component({
selector: 'g[svg-mouse-speed-key]', selector: 'g[svg-mouse-speed-key]',
templateUrl: './svg-mouse-speed-key.html' templateUrl: './svg-mouse-speed-key.html',
changeDetection: ChangeDetectionStrategy.OnPush
}) })
export class SvgMouseSpeedKeyComponent implements OnChanges { export class SvgMouseSpeedKeyComponent implements OnChanges {
@Input() plus: boolean; @Input() plus: boolean;

View File

@@ -1,8 +1,9 @@
import { Component, Input, OnInit } from '@angular/core'; import { Component, Input, OnInit, ChangeDetectionStrategy } from '@angular/core';
@Component({ @Component({
selector: 'g[svg-one-line-text-key]', selector: 'g[svg-one-line-text-key]',
templateUrl: './svg-one-line-text-key.component.html' templateUrl: './svg-one-line-text-key.component.html',
changeDetection: ChangeDetectionStrategy.OnPush
}) })
export class SvgOneLineTextKeyComponent implements OnInit { export class SvgOneLineTextKeyComponent implements OnInit {
@Input() height: number; @Input() height: number;

View File

@@ -1,8 +1,9 @@
import { Component, Input, OnInit } from '@angular/core'; import { Component, Input, OnInit, ChangeDetectionStrategy } from '@angular/core';
@Component({ @Component({
selector: 'g[svg-single-icon-key]', selector: 'g[svg-single-icon-key]',
templateUrl: './svg-single-icon-key.component.html' templateUrl: './svg-single-icon-key.component.html',
changeDetection: ChangeDetectionStrategy.OnPush
}) })
export class SvgSingleIconKeyComponent implements OnInit { export class SvgSingleIconKeyComponent implements OnInit {
@Input() width: number; @Input() width: number;

View File

@@ -1,10 +1,11 @@
import { Component, Input, OnInit } from '@angular/core'; import { Component, Input, OnInit, ChangeDetectionStrategy } from '@angular/core';
import { MapperService } from '../../../../services/mapper.service'; import { MapperService } from '../../../../services/mapper.service';
@Component({ @Component({
selector: 'g[svg-switch-keymap-key]', selector: 'g[svg-switch-keymap-key]',
templateUrl: './svg-switch-keymap-key.component.html' templateUrl: './svg-switch-keymap-key.component.html',
changeDetection: ChangeDetectionStrategy.OnPush
}) })
export class SvgSwitchKeymapKeyComponent implements OnInit { export class SvgSwitchKeymapKeyComponent implements OnInit {
@Input() width: number; @Input() width: number;

View File

@@ -1,8 +1,9 @@
import { Component, Input, OnInit } from '@angular/core'; import { Component, Input, OnInit, ChangeDetectionStrategy } from '@angular/core';
@Component({ @Component({
selector: 'g[svg-text-icon-key]', selector: 'g[svg-text-icon-key]',
templateUrl: './svg-text-icon-key.component.html' templateUrl: './svg-text-icon-key.component.html',
changeDetection: ChangeDetectionStrategy.OnPush
}) })
export class SvgTextIconKeyComponent implements OnInit { export class SvgTextIconKeyComponent implements OnInit {
@Input() width: number; @Input() width: number;

View File

@@ -1,8 +1,9 @@
import { Component, Input, OnInit } from '@angular/core'; import { Component, Input, OnInit, ChangeDetectionStrategy } from '@angular/core';
@Component({ @Component({
selector: 'g[svg-two-line-text-key]', selector: 'g[svg-two-line-text-key]',
templateUrl: './svg-two-line-text-key.component.html' templateUrl: './svg-two-line-text-key.component.html',
changeDetection: ChangeDetectionStrategy.OnPush
}) })
export class SvgTwoLineTextKeyComponent implements OnInit { export class SvgTwoLineTextKeyComponent implements OnInit {
@Input() height: number; @Input() height: number;

View File

@@ -1,4 +1,4 @@
import { Component, EventEmitter, Input, Output } from '@angular/core'; import { Component, EventEmitter, Input, Output, ChangeDetectionStrategy } from '@angular/core';
import { KeyAction } from '../../../config-serializer/config-items/key-action'; import { KeyAction } from '../../../config-serializer/config-items/key-action';
@@ -7,7 +7,8 @@ import { SvgKeyboardKey } from '../keys';
@Component({ @Component({
selector: 'g[svg-module]', selector: 'g[svg-module]',
templateUrl: './svg-module.component.html', templateUrl: './svg-module.component.html',
styleUrls: ['./svg-module.component.scss'] styleUrls: ['./svg-module.component.scss'],
changeDetection: ChangeDetectionStrategy.OnPush
}) })
export class SvgModuleComponent { export class SvgModuleComponent {
@Input() coverages: any[]; @Input() coverages: any[];