-
Notifications
You must be signed in to change notification settings - Fork 66
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
Make it work without requiring Symbol polyfill #2
Comments
Same for |
so babel will add local polyfill but target browsers could be Symbol-ready. so we loose in performance and module size in that case |
Why use the symbol at all? Just change: return {
configurable: true, // must be true or we could not be changing it
get() {
if (!this.hasOwnProperty(_key)) {
this[_key] = fn.bind(this);
}
return this[_key];
}
}; to return {
configurable: true, // must be true or we could not be changing it
get() {
var fn = this[key].bind(this);
Object.defineProperty(this, key, {
configurable: true,
writable: true,
value: fn
});
return fn;
}
}; The current way is slower too since the overhead of the getter is going to be there every single time, regardless of your use of the private bound method. |
@sebmck you are right, that's actually how it was implemented initially fb29744#diff-1fdf421c05c1140f6d71444ea2b27638 |
The best would be to have babel to transpile Symbol itself.
The text was updated successfully, but these errors were encountered: