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

Commit

Permalink
chore(everything): Major Zone Rewrite/Reimplementation
Browse files Browse the repository at this point in the history
BREAKING CHANGE:

This is a brand new implementation which is not backwards compatible.
  • Loading branch information
mhevery committed Feb 29, 2016
1 parent 3ad2445 commit 63d4552
Show file tree
Hide file tree
Showing 97 changed files with 4,976 additions and 5,142 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,5 @@ typings/
parsed-idl/
/node_modules
.idea
.vscode
npm-debug.log
1 change: 0 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,5 +23,4 @@ before_script:

script:
- node_modules/.bin/karma start karma-sauce.conf.js
- node_modules/.bin/karma start karma-microtasks-sauce.conf.js

25 changes: 25 additions & 0 deletions LICENSE.wrapped
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
/**
@license
The MIT License

Copyright (c) 2016 Google, Inc.

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.

*/
7 changes: 6 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,11 @@

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

# NEW Zone.js POST-v0.6.0

See the new API [here](./dist/zone.js.d.ts).

# DEPRECATED Zone.js PRE-v0.5.15

## What's a Zone?

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

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

### `zone.addEventListener`
Expand Down
69 changes: 23 additions & 46 deletions dist/jasmine-patch.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,58 +42,35 @@
/************************************************************************/
/******/ ([
/* 0 */
/***/ function(module, exports, __webpack_require__) {

var jasminePatch = __webpack_require__(1);
jasminePatch.apply();
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiamFzbWluZS1wYXRjaC5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uLy4uL2xpYi9icm93c2VyL2phc21pbmUtcGF0Y2gudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUEsSUFBWSxZQUFZLFdBQU0sa0JBQWtCLENBQUMsQ0FBQTtBQUVqRCxZQUFZLENBQUMsS0FBSyxFQUFFLENBQUMiLCJzb3VyY2VzQ29udGVudCI6WyJpbXBvcnQgKiBhcyBqYXNtaW5lUGF0Y2ggZnJvbSAnLi4vamFzbWluZS9wYXRjaCc7XG5cbmphc21pbmVQYXRjaC5hcHBseSgpO1xuIl19

/***/ },
/* 1 */
/***/ function(module, exports) {

/* WEBPACK VAR INJECTION */(function(global) {'use strict';
// Patch jasmine's it and fit functions so that the `done` callback always resets the zone
// Patch jasmine's it and fit functions so that the `done` wrapCallback always resets the zone
// to the jasmine zone, which should be the root zone. (angular/zone.js#91)
function apply() {
if (!global.zone) {
throw new Error('zone.js does not seem to be installed');
if (!Zone) {
throw new Error('zone.js does not seem to be installed');
}
var SET_TIMEOUT = '__zone_symbol__setTimeout';
// When you have in async test (test with `done` argument) jasmine will
// execute the next test synchronously in the done handler. This makes sense
// for most tests, but now with zones. With zones running next test
// synchronously means that the current zone does not get cleared. This
// results in a chain of nested zones, which makes it hard to reason about
// it. We override the `clearStack` method which forces jasmine to always
// drain the stack before next test gets executed.
jasmine.QueueRunner = (function (SuperQueueRunner) {
// Subclass the `QueueRunner` and override the `clearStack` method.
function alwaysClearStack(fn) {
global[SET_TIMEOUT](fn, 0);
}
if (!global.zone.isRootZone()) {
throw new Error('The jasmine patch should be called from the root zone');
function QueueRunner(options) {
options.clearStack = alwaysClearStack;
SuperQueueRunner.call(this, options);
}
// When you have in async test (test with `done` argument) jasmine will
// execute the next test synchronously in the done handle. This makes sense
// for most tests, but now with zones. With zones running next test
// synchronously means that the current zone does not get cleared. This
// results in a chain of nested zones, which makes it hard to reason about
// it. We override the `clearStack` method which forces jasmine to always
// drain the stack before next test gets executed.
jasmine.QueueRunner = (function (SuperQueueRunner) {
// Subclass the `QueueRunner` and override the `clearStack` mothed.
function alwaysClearStack(fn) {
global.zone.setTimeoutUnpatched(fn, 0);
}
function QueueRunner(options) {
options.clearStack = alwaysClearStack;
SuperQueueRunner.call(this, options);
}
QueueRunner.prototype = SuperQueueRunner.prototype;
return QueueRunner;
})(jasmine.QueueRunner);
}
exports.apply = apply;
if (global.jasmine) {
module.exports = {
apply: apply
};
}
else {
module.exports = {
apply: function () { }
};
}
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoicGF0Y2guanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi8uLi9saWIvamFzbWluZS9wYXRjaC50cyJdLCJuYW1lcyI6WyJhcHBseSIsImFsd2F5c0NsZWFyU3RhY2siLCJRd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uICAgICAgb3B0aW9ucy5jbGVhclN0YWNrID0gYWx3YXlzQ2xlYXJTdGFjaztcbiAgICAgIFN1cGVyUXVldWVSdW5uZXIuY2FsbCh0aGlzLCBvcHRpb25zKTtcbiAgICB9XG4gICAgUXVldWVSdW5uZXIucHJvdG90eXBlID0gU3VwZXJRdWV1ZVJ1bm5lci5wcm90b3R5cGU7XG4gICAgcmV0dXJuIFF1ZXVlUnVubmVyO1xuICB9KSgoPGFueT5qYXNtaW5lKS5RdWV1ZVJ1bm5lcik7XG5cbn1cblxuaWYgKCg8YW55Pmdsb2JhbCkuamFzbWluZSkge1xuICBtb2R1bGUuZXhwb3J0cyA9IHtcbiAgICBhcHBseTogYXBwbHlcbiAgfTtcbn0gZWxzZSB7XG4gIG1vZHVsZS5leHBvcnRzID0ge1xuICAgIGFwcGx5OiBmdW5jdGlvbigpIHsgfVxuICB9O1xufVxuIl19
QueueRunner.prototype = SuperQueueRunner.prototype;
return QueueRunner;
})(jasmine.QueueRunner);

/* WEBPACK VAR INJECTION */}.call(exports, (function() { return this; }())))

/***/ }
Expand Down
2 changes: 1 addition & 1 deletion dist/jasmine-patch.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 63d4552

Please sign in to comment.