refactor(): use const and let instead of var
This commit is contained in:

committed by
Victor Berchet

parent
73593d4bf3
commit
77ee27c59e
@ -75,7 +75,7 @@ export class HammerGestureConfig {
|
||||
mc.get('pinch').set({enable: true});
|
||||
mc.get('rotate').set({enable: true});
|
||||
|
||||
for (let eventName in this.overrides) {
|
||||
for (const eventName in this.overrides) {
|
||||
mc.get(eventName).set(this.overrides[eventName]);
|
||||
}
|
||||
|
||||
|
@ -20,7 +20,7 @@ export class SharedStylesHost {
|
||||
constructor() {}
|
||||
|
||||
addStyles(styles: string[]) {
|
||||
var additions: any[] /** TODO #9100 */ = [];
|
||||
const additions: any[] /** TODO #9100 */ = [];
|
||||
styles.forEach(style => {
|
||||
if (!this._stylesSet.has(style)) {
|
||||
this._stylesSet.add(style);
|
||||
@ -45,7 +45,7 @@ export class DomSharedStylesHost extends SharedStylesHost {
|
||||
}
|
||||
/** @internal */
|
||||
_addStylesToHost(styles: string[], host: Node) {
|
||||
for (var i = 0; i < styles.length; i++) {
|
||||
for (let i = 0; i < styles.length; i++) {
|
||||
const styleEl = document.createElement('style');
|
||||
styleEl.textContent = styles[i];
|
||||
host.appendChild(styleEl);
|
||||
|
@ -6,8 +6,8 @@
|
||||
* found in the LICENSE file at https://angular.io/license
|
||||
*/
|
||||
|
||||
var CAMEL_CASE_REGEXP = /([A-Z])/g;
|
||||
var DASH_CASE_REGEXP = /-([a-z])/g;
|
||||
const CAMEL_CASE_REGEXP = /([A-Z])/g;
|
||||
const DASH_CASE_REGEXP = /-([a-z])/g;
|
||||
|
||||
|
||||
export function camelCaseToDashCase(input: string): string {
|
||||
|
@ -16,8 +16,8 @@ export class WebAnimationsDriver implements AnimationDriver {
|
||||
animate(
|
||||
element: any, startingStyles: AnimationStyles, keyframes: AnimationKeyframe[],
|
||||
duration: number, delay: number, easing: string): WebAnimationsPlayer {
|
||||
var formattedSteps: {[key: string]: string | number}[] = [];
|
||||
var startingStyleLookup: {[key: string]: string | number} = {};
|
||||
let formattedSteps: {[key: string]: string | number}[] = [];
|
||||
let startingStyleLookup: {[key: string]: string | number} = {};
|
||||
if (isPresent(startingStyles) && startingStyles.styles.length > 0) {
|
||||
startingStyleLookup = _populateStyles(element, startingStyles, {});
|
||||
startingStyleLookup['offset'] = 0;
|
||||
@ -25,7 +25,7 @@ export class WebAnimationsDriver implements AnimationDriver {
|
||||
}
|
||||
|
||||
keyframes.forEach((keyframe: AnimationKeyframe) => {
|
||||
let data = _populateStyles(element, keyframe.styles, startingStyleLookup);
|
||||
const data = _populateStyles(element, keyframe.styles, startingStyleLookup);
|
||||
data['offset'] = keyframe.offset;
|
||||
formattedSteps.push(data);
|
||||
});
|
||||
@ -35,12 +35,12 @@ export class WebAnimationsDriver implements AnimationDriver {
|
||||
// end with the same values. Removing the offset and having only
|
||||
// start/end values is suitable enough for the web-animations API
|
||||
if (formattedSteps.length == 1) {
|
||||
var start = formattedSteps[0];
|
||||
const start = formattedSteps[0];
|
||||
start['offset'] = null;
|
||||
formattedSteps = [start, start];
|
||||
}
|
||||
|
||||
var playerOptions: {[key: string]: string | number} = {
|
||||
const playerOptions: {[key: string]: string | number} = {
|
||||
'duration': duration,
|
||||
'delay': delay,
|
||||
'fill': 'both' // we use `both` because it allows for styling at 0% to work with `delay`
|
||||
@ -59,7 +59,7 @@ export class WebAnimationsDriver implements AnimationDriver {
|
||||
function _populateStyles(
|
||||
element: any, styles: AnimationStyles,
|
||||
defaultStyles: {[key: string]: string | number}): {[key: string]: string | number} {
|
||||
var data: {[key: string]: string | number} = {};
|
||||
const data: {[key: string]: string | number} = {};
|
||||
styles.styles.forEach(
|
||||
(entry) => { Object.keys(entry).forEach(prop => { data[prop] = entry[prop]; }); });
|
||||
Object.keys(defaultStyles).forEach(prop => {
|
||||
|
@ -42,8 +42,8 @@ export class WebAnimationsPlayer implements AnimationPlayer {
|
||||
if (this._initialized) return;
|
||||
this._initialized = true;
|
||||
|
||||
var keyframes = this.keyframes.map(styles => {
|
||||
var formattedKeyframe: {[key: string]: string | number} = {};
|
||||
const keyframes = this.keyframes.map(styles => {
|
||||
const formattedKeyframe: {[key: string]: string | number} = {};
|
||||
Object.keys(styles).forEach(prop => {
|
||||
const value = styles[prop];
|
||||
formattedKeyframe[prop] = value == AUTO_STYLE ? _computeStyle(this.element, prop) : value;
|
||||
|
Reference in New Issue
Block a user