-
Notifications
You must be signed in to change notification settings - Fork 3.9k
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
Action handler subsystem #1261
Action handler subsystem #1261
Conversation
@@ -121,6 +126,39 @@ export class ActionService { | |||
} | |||
|
|||
/** | |||
* Installs action handler for the specified element. | |||
* @param {!Element} target | |||
* @param {function(!ActionInvocation)} handler |
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.
do we need a bang on function
? (cant remember if function was implicitly not nullable, i know Function definitely is nullable by default)
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.
No, lower-case function
is non-nullable.
@dvoytenko LGTM |
*/ | ||
installActionHandler(target, handler) { | ||
const debugid = target.tagName + '#' + target.id; | ||
assert(this.isAmpElement_(target), 'AMP element is expected: %s', debugid); |
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.
Should we pass the target
so the error has associatedElement
?
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.
Not in this case. This is a non-authoring visible error. Unfortunately, assert
and associate elements are a bit abused. I believe we are tracking it somewhere in one of the issues. Right, @erwinmombay ?
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.
@dvoytenko correct, tracked in #1031 will continue work on it soon.
deferring to @jridgewell for final LGTM as he has some concerns. |
|
No description provided.