refactor(): use const and let instead of var

This commit is contained in:
Joao Dias
2016-11-12 14:08:58 +01:00
committed by Victor Berchet
parent 73593d4bf3
commit 77ee27c59e
435 changed files with 4637 additions and 4663 deletions

View File

@ -16,7 +16,7 @@ export class BrowserGetTestability implements GetTestability {
addToWindow(registry: TestabilityRegistry): void {
global.getAngularTestability = (elem: any, findInAncestors: boolean = true) => {
var testability = registry.findTestabilityInTree(elem, findInAncestors);
const testability = registry.findTestabilityInTree(elem, findInAncestors);
if (testability == null) {
throw new Error('Could not find testability for element.');
}
@ -27,11 +27,11 @@ export class BrowserGetTestability implements GetTestability {
global.getAllAngularRootElements = () => registry.getAllRootElements();
var whenAllStable = (callback: any /** TODO #9100 */) => {
var testabilities = global.getAllAngularTestabilities();
var count = testabilities.length;
var didWork = false;
var decrement = function(didWork_: any /** TODO #9100 */) {
const whenAllStable = (callback: any /** TODO #9100 */) => {
const testabilities = global.getAllAngularTestabilities();
let count = testabilities.length;
let didWork = false;
const decrement = function(didWork_: any /** TODO #9100 */) {
didWork = didWork || didWork_;
count--;
if (count == 0) {
@ -54,7 +54,7 @@ export class BrowserGetTestability implements GetTestability {
if (elem == null) {
return null;
}
var t = registry.getTestability(elem);
const t = registry.getTestability(elem);
if (isPresent(t)) {
return t;
} else if (!findInAncestors) {

View File

@ -53,15 +53,15 @@ export class AngularProfiler {
* ```
*/
timeChangeDetection(config: any): ChangeDetectionPerfRecord {
var record = config && config['record'];
var profileName = 'Change Detection';
const record = config && config['record'];
const profileName = 'Change Detection';
// Profiler is not available in Android browsers, nor in IE 9 without dev tools opened
var isProfilerAvailable = isPresent(window.console.profile);
const isProfilerAvailable = isPresent(window.console.profile);
if (record && isProfilerAvailable) {
window.console.profile(profileName);
}
const start = getDOM().performanceNow();
var numTicks = 0;
let numTicks = 0;
while (numTicks < 5 || (getDOM().performanceNow() - start) < 500) {
this.appRef.tick();
numTicks++;

View File

@ -11,7 +11,7 @@ import {global} from '../../facade/lang';
import {AngularTools} from './common_tools';
var context = <any>global;
const context = <any>global;
/**
* Enabled Angular 2 debug tools that are accessible via your browser's