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 { SvgModule } from '../module';
@@ -6,7 +6,8 @@ import { SvgModule } from '../module';
@Component({
selector: 'svg-keyboard',
templateUrl: './svg-keyboard.component.html',
styleUrls: ['./svg-keyboard.component.scss']
styleUrls: ['./svg-keyboard.component.scss'],
changeDetection: ChangeDetectionStrategy.OnPush
})
export class SvgKeyboardComponent implements OnInit {
@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({
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 {
@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 { KeyModifiers } from '../../../../config-serializer/config-items/KeyModifiers';
@@ -27,7 +27,8 @@ enum Modifiers {
@Component({
selector: 'g[svg-keystroke-key]',
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 {
@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';
@Component({
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 {
@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';
@Component({
selector: 'g[svg-mouse-key]',
templateUrl: './svg-mouse-key.html'
templateUrl: './svg-mouse-key.html',
changeDetection: ChangeDetectionStrategy.OnPush
})
export class SvgMouseKeyComponent implements OnChanges {
@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';
@Component({
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 {
@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';
@Component({
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 {
@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';
@Component({
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 {
@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({
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 {
@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({
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 {
@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';
@Component({
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 {
@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({
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 {
@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({
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 {
@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';
@@ -7,7 +7,8 @@ import { SvgKeyboardKey } from '../keys';
@Component({
selector: 'g[svg-module]',
templateUrl: './svg-module.component.html',
styleUrls: ['./svg-module.component.scss']
styleUrls: ['./svg-module.component.scss'],
changeDetection: ChangeDetectionStrategy.OnPush
})
export class SvgModuleComponent {
@Input() coverages: any[];