Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

another fix for #261, in extendNative, share prototype, copy direct properties (not from prototype) #506

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 8 additions & 12 deletions pace.js
Original file line number Diff line number Diff line change
Expand Up @@ -378,32 +378,28 @@
_WebSocket = window.WebSocket;

extendNative = function(to, from) {
var e, key, _results;
_results = [];
for (key in from.prototype) {
var key;
for (key in from) {
try {
if ((to[key] == null) && typeof from[key] !== 'function') {
if (typeof Object.defineProperty === 'function') {
_results.push(Object.defineProperty(to, key, {
Object.defineProperty(to, key, {
get: (function(key) {
return function() {
return from.prototype[key];
return from[key];
};
})(key),
configurable: true,
enumerable: true
}));
});
} else {
_results.push(to[key] = from.prototype[key]);
to[key] = from[key];
}
} else {
_results.push(void 0);
}
} catch (_error) {
e = _error;
}
}
return _results;
to.prototype = from.prototype;
};

ignoreStack = [];
Expand Down Expand Up @@ -983,4 +979,4 @@
}
}

}).call(this);
}).call(this);
Loading