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

Commit

Permalink
fix: commonjs wrapper
Browse files Browse the repository at this point in the history
Closes #19
  • Loading branch information
btford committed Jun 4, 2014
1 parent 4b6e411 commit 17ed147
Showing 1 changed file with 10 additions and 7 deletions.
17 changes: 10 additions & 7 deletions zone.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
'use strict';

(function (window) {


function Zone(parentZone, data) {
var zone = (arguments.length) ? Object.create(parentZone) : this;
Expand Down Expand Up @@ -118,7 +120,7 @@ Zone.patchSetClearFn = function (obj, fnNames) {
var ids = {};

if (setName === 'setInterval') {
zone[setName] = function (fn) {
window.zone[setName] = function (fn) {
var id;
arguments[0] = function () {
delete ids[id];
Expand All @@ -130,7 +132,7 @@ Zone.patchSetClearFn = function (obj, fnNames) {
return id;
};
} else {
zone[setName] = function (fn) {
window.zone[setName] = function (fn) {
var id;
arguments[0] = function () {
delete ids[id];
Expand Down Expand Up @@ -538,13 +540,14 @@ Zone.onEventNames = Zone.eventNames.map(function (property) {
});

Zone.init = function init () {
if (typeof module !== 'undefined' && module && module.exports) {
module.exports = new Zone();
} else {
window.zone = new Zone();
}
window.zone = new Zone();
Zone.patch();
};


Zone.init();

window.Zone = Zone;

}((typeof module !== 'undefined' && module && module.exports) ?
module.exports : window));

0 comments on commit 17ed147

Please sign in to comment.