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

Commit 63d4552

Browse files
committed
chore(everything): Major Zone Rewrite/Reimplementation
BREAKING CHANGE: This is a brand new implementation which is not backwards compatible.
1 parent 3ad2445 commit 63d4552

File tree

97 files changed

+4976
-5142
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

97 files changed

+4976
-5142
lines changed

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,3 +5,5 @@ typings/
55
parsed-idl/
66
/node_modules
77
.idea
8+
.vscode
9+
npm-debug.log

.travis.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,5 +23,4 @@ before_script:
2323

2424
script:
2525
- node_modules/.bin/karma start karma-sauce.conf.js
26-
- node_modules/.bin/karma start karma-microtasks-sauce.conf.js
2726

LICENSE.wrapped

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
/**
2+
@license
3+
The MIT License
4+
5+
Copyright (c) 2016 Google, Inc.
6+
7+
Permission is hereby granted, free of charge, to any person obtaining a copy
8+
of this software and associated documentation files (the "Software"), to deal
9+
in the Software without restriction, including without limitation the rights
10+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
11+
copies of the Software, and to permit persons to whom the Software is
12+
furnished to do so, subject to the following conditions:
13+
14+
The above copyright notice and this permission notice shall be included in
15+
all copies or substantial portions of the Software.
16+
17+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
20+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
22+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
23+
THE SOFTWARE.
24+
25+
*/

README.md

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,11 @@
44

55
Implements _Zones_ for JavaScript, inspired by [Dart](https://www.dartlang.org/articles/zones/).
66

7+
# NEW Zone.js POST-v0.6.0
8+
9+
See the new API [here](./dist/zone.js.d.ts).
10+
11+
# DEPRECATED Zone.js PRE-v0.5.15
712

813
## What's a Zone?
914

@@ -236,7 +241,7 @@ While in this zone, calls to `window.setTimeout` will redirect to `zone.setTimeo
236241
These hooks allow you to change the behavior of `window.requestAnimationFrame()`,
237242
`window.webkitRequestAnimationFrame`, and `window.mozRequestAnimationFrame`.
238243

239-
By default the callback is executed in the zone where those methods have been called to avoid
244+
By default the wrapCallback is executed in the zone where those methods have been called to avoid
240245
growing the stack size on each recursive call.
241246

242247
### `zone.addEventListener`

dist/jasmine-patch.js

Lines changed: 23 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -42,58 +42,35 @@
4242
/************************************************************************/
4343
/******/ ([
4444
/* 0 */
45-
/***/ function(module, exports, __webpack_require__) {
46-
47-
var jasminePatch = __webpack_require__(1);
48-
jasminePatch.apply();
49-
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiamFzbWluZS1wYXRjaC5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uLy4uL2xpYi9icm93c2VyL2phc21pbmUtcGF0Y2gudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUEsSUFBWSxZQUFZLFdBQU0sa0JBQWtCLENBQUMsQ0FBQTtBQUVqRCxZQUFZLENBQUMsS0FBSyxFQUFFLENBQUMiLCJzb3VyY2VzQ29udGVudCI6WyJpbXBvcnQgKiBhcyBqYXNtaW5lUGF0Y2ggZnJvbSAnLi4vamFzbWluZS9wYXRjaCc7XG5cbmphc21pbmVQYXRjaC5hcHBseSgpO1xuIl19
50-
51-
/***/ },
52-
/* 1 */
5345
/***/ function(module, exports) {
5446

5547
/* WEBPACK VAR INJECTION */(function(global) {'use strict';
56-
// Patch jasmine's it and fit functions so that the `done` callback always resets the zone
48+
// Patch jasmine's it and fit functions so that the `done` wrapCallback always resets the zone
5749
// to the jasmine zone, which should be the root zone. (angular/zone.js#91)
58-
function apply() {
59-
if (!global.zone) {
60-
throw new Error('zone.js does not seem to be installed');
50+
if (!Zone) {
51+
throw new Error('zone.js does not seem to be installed');
52+
}
53+
var SET_TIMEOUT = '__zone_symbol__setTimeout';
54+
// When you have in async test (test with `done` argument) jasmine will
55+
// execute the next test synchronously in the done handler. This makes sense
56+
// for most tests, but now with zones. With zones running next test
57+
// synchronously means that the current zone does not get cleared. This
58+
// results in a chain of nested zones, which makes it hard to reason about
59+
// it. We override the `clearStack` method which forces jasmine to always
60+
// drain the stack before next test gets executed.
61+
jasmine.QueueRunner = (function (SuperQueueRunner) {
62+
// Subclass the `QueueRunner` and override the `clearStack` method.
63+
function alwaysClearStack(fn) {
64+
global[SET_TIMEOUT](fn, 0);
6165
}
62-
if (!global.zone.isRootZone()) {
63-
throw new Error('The jasmine patch should be called from the root zone');
66+
function QueueRunner(options) {
67+
options.clearStack = alwaysClearStack;
68+
SuperQueueRunner.call(this, options);
6469
}
65-
// When you have in async test (test with `done` argument) jasmine will
66-
// execute the next test synchronously in the done handle. This makes sense
67-
// for most tests, but now with zones. With zones running next test
68-
// synchronously means that the current zone does not get cleared. This
69-
// results in a chain of nested zones, which makes it hard to reason about
70-
// it. We override the `clearStack` method which forces jasmine to always
71-
// drain the stack before next test gets executed.
72-
jasmine.QueueRunner = (function (SuperQueueRunner) {
73-
// Subclass the `QueueRunner` and override the `clearStack` mothed.
74-
function alwaysClearStack(fn) {
75-
global.zone.setTimeoutUnpatched(fn, 0);
76-
}
77-
function QueueRunner(options) {
78-
options.clearStack = alwaysClearStack;
79-
SuperQueueRunner.call(this, options);
80-
}
81-
QueueRunner.prototype = SuperQueueRunner.prototype;
82-
return QueueRunner;
83-
})(jasmine.QueueRunner);
84-
}
85-
exports.apply = apply;
86-
if (global.jasmine) {
87-
module.exports = {
88-
apply: apply
89-
};
90-
}
91-
else {
92-
module.exports = {
93-
apply: function () { }
94-
};
95-
}
96-
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoicGF0Y2guanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi8uLi9saWIvamFzbWluZS9wYXRjaC50cyJdLCJuYW1lcyI6WyJhcHBseSIsImFsd2F5c0NsZWFyU3RhY2siLCJRdWV1ZVJ1bm5lciJdLCJtYXBwaW5ncyI6IkFBQUEsWUFBWSxDQUFDO0FBQ2IsMEZBQTBGO0FBQzFGLDJFQUEyRTtBQUUzRTtJQUNFQSxFQUFFQSxDQUFDQSxDQUFDQSxDQUFDQSxNQUFNQSxDQUFDQSxJQUFJQSxDQUFDQSxDQUFDQSxDQUFDQTtRQUNqQkEsTUFBTUEsSUFBSUEsS0FBS0EsQ0FBQ0EsdUNBQXVDQSxDQUFDQSxDQUFDQTtJQUMzREEsQ0FBQ0E7SUFFREEsRUFBRUEsQ0FBQ0EsQ0FBQ0EsQ0FBQ0EsTUFBTUEsQ0FBQ0EsSUFBSUEsQ0FBQ0EsVUFBVUEsRUFBRUEsQ0FBQ0EsQ0FBQ0EsQ0FBQ0E7UUFDOUJBLE1BQU1BLElBQUlBLEtBQUtBLENBQUNBLHVEQUF1REEsQ0FBQ0EsQ0FBQ0E7SUFDM0VBLENBQUNBO0lBRURBLHVFQUF1RUE7SUFDdkVBLDJFQUEyRUE7SUFDM0VBLG1FQUFtRUE7SUFDbkVBLHVFQUF1RUE7SUFDdkVBLDBFQUEwRUE7SUFDMUVBLHlFQUF5RUE7SUFDekVBLGtEQUFrREE7SUFDNUNBLE9BQVFBLENBQUNBLFdBQVdBLEdBQUdB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ZXN0IGdldHMgZXhlY3V0ZWQuXG4gICg8YW55Pmphc21pbmUpLlF1ZXVlUnVubmVyID0gKGZ1bmN0aW9uIChTdXBlclF1ZXVlUnVubmVyKSB7XG4gICAgLy8gU3ViY2xhc3MgdGhlIGBRdWV1ZVJ1bm5lcmAgYW5kIG92ZXJyaWRlIHRoZSBgY2xlYXJTdGFja2AgbW90aGVkLlxuXG4gICAgZnVuY3Rpb24gYWx3YXlzQ2xlYXJTdGFjayhmbikge1xuICAgICAgZ2xvYmFsLnpvbmUuc2V0VGltZW91dFVucGF0Y2hlZChmbiwgMCk7XG4gICAgfVxuXG4gICAgZnVuY3Rpb24gUXVldWVSdW5uZXIob3B0aW9ucykge1xuICAgICAgb3B0aW9ucy5jbGVhclN0YWNrID0gYWx3YXlzQ2xlYXJTdGFjaztcbiAgICAgIFN1cGVyUXVldWVSdW5uZXIuY2FsbCh0aGlzLCBvcHRpb25zKTtcbiAgICB9XG4gICAgUXVldWVSdW5uZXIucHJvdG90eXBlID0gU3VwZXJRdWV1ZVJ1bm5lci5wcm90b3R5cGU7XG4gICAgcmV0dXJuIFF1ZXVlUnVubmVyO1xuICB9KSgoPGFueT5qYXNtaW5lKS5RdWV1ZVJ1bm5lcik7XG5cbn1cblxuaWYgKCg8YW55Pmdsb2JhbCkuamFzbWluZSkge1xuICBtb2R1bGUuZXhwb3J0cyA9IHtcbiAgICBhcHBseTogYXBwbHlcbiAgfTtcbn0gZWxzZSB7XG4gIG1vZHVsZS5leHBvcnRzID0ge1xuICAgIGFwcGx5OiBmdW5jdGlvbigpIHsgfVxuICB9O1xufVxuIl19
70+
QueueRunner.prototype = SuperQueueRunner.prototype;
71+
return QueueRunner;
72+
})(jasmine.QueueRunner);
73+
9774
/* WEBPACK VAR INJECTION */}.call(exports, (function() { return this; }())))
9875

9976
/***/ }

dist/jasmine-patch.min.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)