-
Notifications
You must be signed in to change notification settings - Fork 19
Refactor - IDL class def #104
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
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Alright, I don't understand everything but the results are solid!
@@ -130,6 +130,10 @@ module.exports = (jsExport, nativeBinding) => { | |||
} | |||
|
|||
set fftSize(value) { | |||
if (!(this instanceof AnalyserNode)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm very surprised we need to check this inside the class AnalyserNode?
Also, instanceof
works with inheritance properly right? So if a user has MyNode extends AnalyserNode
these methods are still callable?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah yup I was a bit surprised too at first... but actually it makes sens since this is always possible to try to execute anything with the this
you want in JS, e.g. this is the test which is made in the idlharness (warning it can hurt you eyes :):
const desc = Object.getOwnPropertyDescriptor(AnalyserNode.prototype, 'fftSize');
desc.set.call({}, 256);
Also, instanceof works with inheritance properly right. So if a user has MyNode extends AnalyserNode these methods are still callable?
Yup it should, which is nice
Some heavy work and JS black magic to make more idlharness tests pass
Impact on overall wpt is interesting too (unlocked quite a few tests :)