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

@ -11,7 +11,7 @@ import {EventEmitter} from '../src/async';
export function main() {
describe('EventEmitter', () => {
var emitter: EventEmitter<any>;
let emitter: EventEmitter<any>;
beforeEach(() => { emitter = new EventEmitter(); });
@ -52,7 +52,7 @@ export function main() {
}));
it('should subscribe to the wrapper synchronously', () => {
var called = false;
let called = false;
emitter.subscribe({next: (value: any) => { called = true; }});
emitter.emit(99);
@ -61,7 +61,7 @@ export function main() {
it('delivers next and error events synchronously',
inject([AsyncTestCompleter], (async: AsyncTestCompleter) => {
let log: any[] /** TODO #9100 */ = [];
const log: any[] /** TODO #9100 */ = [];
emitter.subscribe({
next: (x: any) => {
@ -82,7 +82,7 @@ export function main() {
}));
it('delivers next and complete events synchronously', () => {
let log: any[] /** TODO #9100 */ = [];
const log: any[] /** TODO #9100 */ = [];
emitter.subscribe({
next: (x: any) => {
@ -105,8 +105,8 @@ export function main() {
it('delivers events asynchronously when forced to async mode',
inject([AsyncTestCompleter], (async: AsyncTestCompleter) => {
var e = new EventEmitter(true);
var log: any[] /** TODO #9100 */ = [];
const e = new EventEmitter(true);
const log: any[] /** TODO #9100 */ = [];
e.subscribe((x: any) => {
log.push(x);
expect(log).toEqual([1, 3, 2]);
@ -119,7 +119,7 @@ export function main() {
}));
it('reports whether it has subscribers', () => {
var e = new EventEmitter(false);
const e = new EventEmitter(false);
expect(e.observers.length > 0).toBe(false);
e.subscribe({next: () => {}});
expect(e.observers.length > 0).toBe(true);