Skip to content
This repository was archived by the owner on Feb 26, 2024. It is now read-only.

Commit e110834

Browse files
committed
fix(typo): fix typo, remove extra semicolons, unify api doc
1 parent 0d0ee53 commit e110834

14 files changed

+46
-54
lines changed

STANDARD-APIS.md

+1-3
Original file line numberDiff line numberDiff line change
@@ -70,9 +70,7 @@ inherit from EventTarget will also be patched.
7070
|IDBCursor|DBIndex|WebSocket|
7171

7272
on properties, such as onclick, onreadystatechange, the following on properties will
73-
be patched as EventTask
74-
75-
- all on properties
73+
be patched as EventTask, the following is the on properties zone.js patched
7674

7775
|||||||||
7876
|---|---|---|---|---|---|---|---|

lib/browser/define-property.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -53,13 +53,13 @@ export function propertyPatch() {
5353
}
5454
return desc;
5555
};
56-
};
56+
}
5757

5858
export function _redefineProperty(obj: any, prop: string, desc: any) {
5959
const originalConfigurableFlag = desc.configurable;
6060
desc = rewriteDescriptor(obj, prop, desc);
6161
return _tryDefineProperty(obj, prop, desc, originalConfigurableFlag);
62-
};
62+
}
6363

6464
function isUnconfigurable(obj: any, prop: any) {
6565
return obj && obj[unconfigurablesKey] && obj[unconfigurablesKey][prop];

lib/browser/property-descriptor.ts

+3-3
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ function canPatchViaPropertyDescriptor() {
7979
// restore original desc
8080
Object.defineProperty(XMLHttpRequest.prototype, 'onreadystatechange', xhrDesc || {});
8181
return result;
82-
};
82+
}
8383

8484
const unboundKey = zoneSymbol('unbound');
8585

@@ -106,5 +106,5 @@ function patchViaCapturingAllTheEvents() {
106106
elt = elt.parentElement;
107107
}
108108
}, true);
109-
};
110-
};
109+
}
110+
}

lib/common/timers.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ export function patchTimer(window: any, setName: string, cancelName: string, nam
2929
} finally {
3030
delete tasksByHandleId[data.handleId];
3131
}
32-
};
32+
}
3333
data.args[0] = timer;
3434
data.handleId = setNative.apply(window, data.args);
3535
tasksByHandleId[data.handleId] = task;

lib/common/utils.ts

+3-9
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ export function patchProperty(obj: any, prop: string) {
128128
};
129129

130130
Object.defineProperty(obj, prop, desc);
131-
};
131+
}
132132

133133
export function patchOnProperties(obj: any, properties: string[]) {
134134
const onProperties = [];
@@ -145,7 +145,7 @@ export function patchOnProperties(obj: any, properties: string[]) {
145145
patchProperty(obj, 'on' + properties[i]);
146146
}
147147
}
148-
};
148+
}
149149

150150
const EVENT_TASKS = zoneSymbol('eventTasks');
151151

@@ -363,8 +363,6 @@ export function makeZoneAwareRemoveAllListeners(fnName: string, useCapturingPara
363363
}
364364

365365
export function makeZoneAwareListeners(fnName: string) {
366-
const symbol = zoneSymbol(fnName);
367-
368366
return function zoneAwareEventListeners(self: any, args: any[]) {
369367
const eventName: string = args[0];
370368
const target = self || _global;
@@ -377,10 +375,6 @@ export function makeZoneAwareListeners(fnName: string) {
377375
};
378376
}
379377

380-
const zoneAwareAddEventListener =
381-
makeZoneAwareAddListener(ADD_EVENT_LISTENER, REMOVE_EVENT_LISTENER);
382-
const zoneAwareRemoveEventListener = makeZoneAwareRemoveListener(REMOVE_EVENT_LISTENER);
383-
384378
export function patchEventTargetMethods(
385379
obj: any, addFnName: string = ADD_EVENT_LISTENER, removeFnName: string = REMOVE_EVENT_LISTENER,
386380
metaCreator: (self: any, args: any[]) => ListenerTaskMeta =
@@ -469,7 +463,7 @@ export function patchClass(className: string) {
469463
_global[className][prop] = OriginalClass[prop];
470464
}
471465
}
472-
};
466+
}
473467

474468
export function createNamedFn(name: string, delegate: (self: any, args: any[]) => any): Function {
475469
try {

lib/extra/bluebird.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
* Use of this source code is governed by an MIT-style license that can be
66
* found in the LICENSE file at https://angular.io/license
77
*/
8-
((_global: any) => {
8+
(() => {
99
const __symbol__ = (Zone as any).__symbol__;
1010
// TODO: @JiaLiPassion, we can automatically patch bluebird
1111
// if global.Promise = Bluebird, but sometimes in nodejs,
@@ -17,4 +17,4 @@
1717
Zone.current.scheduleMicroTask('bluebird', fn);
1818
});
1919
};
20-
})(typeof window === 'object' && window || typeof self === 'object' && self || global);
20+
})();

lib/jasmine/jasmine.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@
4141
// Example:
4242
// - In beforeEach() do childZone = Zone.current.fork(...);
4343
// - In it() try to do fakeAsync(). The issue is that because the beforeEach forked the
44-
// zone outside of fakeAsync it will be able to escope the fakeAsync rules.
44+
// zone outside of fakeAsync it will be able to escape the fakeAsync rules.
4545
// - Because ProxyZone is parent fo `childZone` fakeAsync can retroactively add
4646
// fakeAsync behavior to the childZone.
4747
let testProxyZone: Zone = null;

lib/zone.ts

+22-22
Original file line numberDiff line numberDiff line change
@@ -214,7 +214,7 @@ interface Zone {
214214
/**
215215
* Execute the Task by restoring the [Zone.currentTask] in the Task's zone.
216216
*
217-
* @param callback
217+
* @param task to run
218218
* @param applyThis
219219
* @param applyArgs
220220
* @returns {*}
@@ -310,12 +310,12 @@ interface ZoneType {
310310
*/
311311
interface ZoneSpec {
312312
/**
313-
* The name of the zone. Usefull when debugging Zones.
313+
* The name of the zone. Useful when debugging Zones.
314314
*/
315315
name: string;
316316

317317
/**
318-
* A set of properties to be associated with Zone. Use [Zone.get] to retrive them.
318+
* A set of properties to be associated with Zone. Use [Zone.get] to retrieve them.
319319
*/
320320
properties?: {[key: string]: any};
321321

@@ -325,7 +325,7 @@ interface ZoneSpec {
325325
* When the zone is being forked, the request is forwarded to this method for interception.
326326
*
327327
* @param parentZoneDelegate Delegate which performs the parent [ZoneSpec] operation.
328-
* @param currentZone The current [Zone] where the current interceptor has beed declared.
328+
* @param currentZone The current [Zone] where the current interceptor has been declared.
329329
* @param targetZone The [Zone] which originally received the request.
330330
* @param zoneSpec The argument passed into the `fork` method.
331331
*/
@@ -337,7 +337,7 @@ interface ZoneSpec {
337337
* Allows interception of the wrapping of the callback.
338338
*
339339
* @param parentZoneDelegate Delegate which performs the parent [ZoneSpec] operation.
340-
* @param currentZone The current [Zone] where the current interceptor has beed declared.
340+
* @param currentZone The current [Zone] where the current interceptor has been declared.
341341
* @param targetZone The [Zone] which originally received the request.
342342
* @param delegate The argument passed into the `warp` method.
343343
* @param source The argument passed into the `warp` method.
@@ -350,7 +350,7 @@ interface ZoneSpec {
350350
* Allows interception of the callback invocation.
351351
*
352352
* @param parentZoneDelegate Delegate which performs the parent [ZoneSpec] operation.
353-
* @param currentZone The current [Zone] where the current interceptor has beed declared.
353+
* @param currentZone The current [Zone] where the current interceptor has been declared.
354354
* @param targetZone The [Zone] which originally received the request.
355355
* @param delegate The argument passed into the `run` method.
356356
* @param applyThis The argument passed into the `run` method.
@@ -365,7 +365,7 @@ interface ZoneSpec {
365365
* Allows interception of the error handling.
366366
*
367367
* @param parentZoneDelegate Delegate which performs the parent [ZoneSpec] operation.
368-
* @param currentZone The current [Zone] where the current interceptor has beed declared.
368+
* @param currentZone The current [Zone] where the current interceptor has been declared.
369369
* @param targetZone The [Zone] which originally received the request.
370370
* @param error The argument passed into the `handleError` method.
371371
*/
@@ -377,7 +377,7 @@ interface ZoneSpec {
377377
* Allows interception of task scheduling.
378378
*
379379
* @param parentZoneDelegate Delegate which performs the parent [ZoneSpec] operation.
380-
* @param currentZone The current [Zone] where the current interceptor has beed declared.
380+
* @param currentZone The current [Zone] where the current interceptor has been declared.
381381
* @param targetZone The [Zone] which originally received the request.
382382
* @param task The argument passed into the `scheduleTask` method.
383383
*/
@@ -389,10 +389,10 @@ interface ZoneSpec {
389389
applyThis: any, applyArgs: any) => any;
390390

391391
/**
392-
* Allows interception of task cancelation.
392+
* Allows interception of task cancellation.
393393
*
394394
* @param parentZoneDelegate Delegate which performs the parent [ZoneSpec] operation.
395-
* @param currentZone The current [Zone] where the current interceptor has beed declared.
395+
* @param currentZone The current [Zone] where the current interceptor has been declared.
396396
* @param targetZone The [Zone] which originally received the request.
397397
* @param task The argument passed into the `cancelTask` method.
398398
*/
@@ -403,12 +403,13 @@ interface ZoneSpec {
403403
* Notifies of changes to the task queue empty status.
404404
*
405405
* @param parentZoneDelegate Delegate which performs the parent [ZoneSpec] operation.
406-
* @param currentZone The current [Zone] where the current interceptor has beed declared.
406+
* @param currentZone The current [Zone] where the current interceptor has been declared.
407407
* @param targetZone The [Zone] which originally received the request.
408-
* @param isEmpty
408+
* @param hasTaskState
409409
*/
410410
onHasTask?:
411-
(delegate: ZoneDelegate, current: Zone, target: Zone, hasTaskState: HasTaskState) => void;
411+
(parentZoneDelegate: ZoneDelegate, currentZone: Zone, targetZone: Zone,
412+
hasTaskState: HasTaskState) => void;
412413
}
413414

414415

@@ -568,7 +569,7 @@ interface Task {
568569

569570
/**
570571
* Cancel the scheduling request. This method can be called from `ZoneSpec.onScheduleTask` to
571-
* cancel the current scheduling interception. Once canceled the task can be discarted or
572+
* cancel the current scheduling interception. Once canceled the task can be discarded or
572573
* rescheduled using `Zone.scheduleTask` on a different zone.
573574
*/
574575
cancelScheduleRequest(): void;
@@ -596,7 +597,7 @@ interface Error {
596597
zoneAwareStack?: string;
597598

598599
/**
599-
* Original stack trace with no modiffications
600+
* Original stack trace with no modifications
600601
*/
601602
originalStack?: string;
602603
}
@@ -1090,7 +1091,6 @@ const Zone: ZoneType = (function(global: any) {
10901091
eventTask: counts.eventTask > 0,
10911092
change: type
10921093
};
1093-
// TODO(misko): what should happen if it throws?
10941094
this.hasTask(this.zone, isEmpty);
10951095
}
10961096
}
@@ -1206,7 +1206,7 @@ const Zone: ZoneType = (function(global: any) {
12061206

12071207
function __symbol__(name: string) {
12081208
return '__zone_symbol__' + name;
1209-
};
1209+
}
12101210
const symbolSetTimeout = __symbol__('setTimeout');
12111211
const symbolPromise = __symbol__('Promise');
12121212
const symbolThen = __symbol__('then');
@@ -1579,9 +1579,9 @@ const Zone: ZoneType = (function(global: any) {
15791579
if (resultPromise instanceof ZoneAwarePromise) {
15801580
return resultPromise;
15811581
}
1582-
let Ctor = resultPromise.constructor;
1583-
if (!Ctor[symbolThenPatched]) {
1584-
patchThen(Ctor);
1582+
let ctor = resultPromise.constructor;
1583+
if (!ctor[symbolThenPatched]) {
1584+
patchThen(ctor);
15851585
}
15861586
return resultPromise;
15871587
};
@@ -1596,7 +1596,7 @@ const Zone: ZoneType = (function(global: any) {
15961596
}
15971597
}
15981598

1599-
// This is not part of public API, but it is usefull for tests, so we expose it.
1599+
// This is not part of public API, but it is useful for tests, so we expose it.
16001600
(Promise as any)[Zone.__symbol__('uncaughtPromiseErrors')] = _uncaughtPromiseErrors;
16011601

16021602
/*
@@ -1775,7 +1775,7 @@ const Zone: ZoneType = (function(global: any) {
17751775
});
17761776

17771777
// Now we need to populate the `blacklistedStackFrames` as well as find the
1778-
// run/runGuraded/runTask frames. This is done by creating a detect zone and then threading
1778+
// run/runGuarded/runTask frames. This is done by creating a detect zone and then threading
17791779
// the execution through all of the above methods so that we can look at the stack trace and
17801780
// find the frames of interest.
17811781
let detectZone: Zone = Zone.current.fork({

test/browser/WebSocket.spec.ts

+3-3
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@ declare const window: any;
1111

1212
const TIMEOUT = 5000;
1313

14-
if (!window['soucelabs']) {
15-
// SouceLabs does not support WebSockets; skip these tests
14+
if (!window['saucelabs']) {
15+
// sauceLabs does not support WebSockets; skip these tests
1616

1717
describe('WebSocket', ifEnvSupports('WebSocket', function() {
1818
let socket: WebSocket;
@@ -76,7 +76,7 @@ if (!window['soucelabs']) {
7676
expect(log).toEqual('a');
7777
done();
7878
}, 10);
79-
};
79+
}
8080

8181
socket.addEventListener('message', logOnMessage);
8282
socket.send('hi');

test/browser/element.spec.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ describe('element', function() {
3636
// `this` would be null inside the method when `addEventListener` is called from strict mode
3737
// it would be `window`:
3838
// - when called from non strict-mode,
39-
// - when `window.addEventListener` is called explicitely.
39+
// - when `window.addEventListener` is called explicitly.
4040
addEventListener('click', listener);
4141

4242
button.dispatchEvent(clickEvent);
@@ -88,7 +88,7 @@ describe('element', function() {
8888
* 3. Pay the cost of throwing an exception in event tasks and verifying that we are the
8989
* top most frame.
9090
*
91-
* For now we are choosing to ignore it and assume that this arrises in tests only.
91+
* For now we are choosing to ignore it and assume that this arises in tests only.
9292
* As an added measure we make sure that all jasmine tests always run in a task. See: jasmine.ts
9393
*/
9494
(window as any)[(Zone as any).__symbol__('setTimeout')](() => {

test/saucelabs.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,4 @@
66
* found in the LICENSE file at https://angular.io/license
77
*/
88

9-
window.soucelabs = true;
9+
window.saucelabs = true;

test/test-util.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -33,4 +33,4 @@ export function ifEnvSupports(test: any, block: Function) {
3333
});
3434
}
3535
};
36-
};
36+
}

test/zone-spec/long-stack-trace-zone.spec.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ describe('longStackTraceZone', function() {
5555
});
5656

5757
it('should produce a long stack trace even if stack setter throws', (done) => {
58-
let wasStackAssigne = false;
58+
let wasStackAssigned = false;
5959
let error = new Error('Expected error');
6060
defineProperty(error, 'stack', {
6161
configurable: false,

test/zone-spec/proxy.spec.ts

+3-3
Original file line numberDiff line numberDiff line change
@@ -76,9 +76,9 @@ describe('ProxySpec', () => {
7676
});
7777

7878
it('should fork', () => {
79-
const forkeZone = proxyZone.fork({name: 'fork'});
80-
expect(forkeZone).not.toBe(proxyZone);
81-
expect(forkeZone.name).toBe('fork');
79+
const forkedZone = proxyZone.fork({name: 'fork'});
80+
expect(forkedZone).not.toBe(proxyZone);
81+
expect(forkedZone.name).toBe('fork');
8282
let called = false;
8383
proxyZoneSpec.setDelegate({
8484
name: '.',

0 commit comments

Comments
 (0)