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

Commit 7b4fdde

Browse files
committed
fix: commonjs wrapper
Closes #19
1 parent f1cbad9 commit 7b4fdde

File tree

1 file changed

+13
-8
lines changed

1 file changed

+13
-8
lines changed

Diff for: zone.js

+13-8
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
'use strict';
22

3+
(function (window) {
4+
5+
var zone = null;
6+
37

48
function Zone(parentZone, data) {
59
var zone = (arguments.length) ? Object.create(parentZone) : this;
@@ -79,10 +83,10 @@ Zone.prototype = {
7983
run: function run (fn, applyTo, applyWith) {
8084
applyWith = applyWith || [];
8185

82-
var oldZone = window.zone,
86+
var oldZone = zone,
8387
result;
8488

85-
window.zone = this;
89+
window.zone = zone = this;
8690

8791
try {
8892
this.beforeTask();
@@ -95,7 +99,7 @@ Zone.prototype = {
9599
}
96100
} finally {
97101
this.afterTask();
98-
window.zone = oldZone;
102+
window.zone = zone = oldZone;
99103
}
100104
return result;
101105
},
@@ -665,13 +669,14 @@ Zone.onEventNames = Zone.eventNames.map(function (property) {
665669
});
666670

667671
Zone.init = function init () {
668-
if (typeof module !== 'undefined' && module && module.exports) {
669-
module.exports = new Zone();
670-
} else {
671-
window.zone = new Zone();
672-
}
672+
window.zone = zone = new Zone();
673673
Zone.patch();
674674
};
675675

676676

677677
Zone.init();
678+
679+
window.Zone = Zone;
680+
681+
}((typeof module !== 'undefined' && module && module.exports) ?
682+
module.exports : window));

0 commit comments

Comments
 (0)