-
Notifications
You must be signed in to change notification settings - Fork 26
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
Add handler term from plenary description #87
base: main
Are you sure you want to change the base?
Conversation
I think this would need to be more specific than just "handler". 🤔 I think the most common use of "handler (function)" is as a synonym for "(event) callback". |
|
||
#### Definition | ||
|
||
A parameter value that is a JavaScript object with properties looked up lazily. It is used to configure behavior of a function. Methods on the options bag object should be invoked with the handler as the default value for `this`. It is expected that this parameter has specific well known properties in their structure. Handlers are expected to potentially be extended over time. |
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.
A parameter value that is a JavaScript object with properties looked up lazily. It is used to configure behavior of a function. Methods on the options bag object should be invoked with the handler as the default value for `this`. It is expected that this parameter has specific well known properties in their structure. Handlers are expected to potentially be extended over time. | |
A parameter value that is a JavaScript object with properties looked up lazily (used in `new Proxy`). It is used to configure behavior of a function. Methods on the options bag object should be invoked with the handler as the default value for `this`. It is expected that this parameter has specific well known properties in their structure. Handlers are expected to potentially be extended over time. |
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.
this is not unique to proxy if we consider DOM. I also dont think we should carve out that it only applies to proxies. future APIs may adopt this pattern
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.
sure, my suggestion doesn't indicate it's unique to proxy, just that it is used in Proxy, as an example.
Where in the DOM is this pattern used?
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.
Various places in DOM, easy to see for .addEventListener
// never even returns a function to invoke
window.addEventListener('foo', {
UNIQUE_NAME: true,
get handleEvent() { console.log(this); }
});
window.dispatchEvent(new CustomEvent('foo'));
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.
wow, i have never seen any code pass anything but a function in that position of addEventListener
.
Co-authored-by: Jordan Harband <[email protected]>
|
||
#### Definition | ||
|
||
A parameter value that is a JavaScript object with properties looked up lazily. It is used to configure behavior of a function. Methods on the options bag object should be invoked with the handler as the default value for `this`. It is expected that this parameter has specific well known properties in their structure. Handlers are expected to potentially be extended over time. |
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.
Maybe we should add here that this is a specialized kind of options bag?
No description provided.