-
Notifications
You must be signed in to change notification settings - Fork 453
Enhance handleProperty function to dynamically handle additional properties #2098
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
Changes from 2 commits
3267a8f
0377309
37efe71
3884300
afd7b3e
c63e69c
18881d4
a2beb93
ea9284b
36e43e3
8e75e22
501d38e
d504495
405e381
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,7 @@ | ||
| interface-mixin GlobalEventHandlers { | ||
| property ontouchcancel optional=#true | ||
| property ontouchend optional=#true | ||
| property ontouchmove optional=#true | ||
| property ontouchstart optional=#true | ||
| property onerror overrideType=OnErrorEventHandler | ||
|
||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -119,10 +119,19 @@ function handleEvent(child: Node): Event { | |
| * @param child The child node to handle. | ||
| */ | ||
| function handleProperty(child: Node): Partial<Property> { | ||
| return { | ||
| const result: Partial<Property> = { | ||
| name: child.values[0] as string, | ||
| exposed: child.properties?.exposed as string, | ||
| }; | ||
|
|
||
| const props: (keyof Property)[] = ["exposed", "optional", "overrideType"]; | ||
|
|
||
| props.forEach((prop) => { | ||
| const value = child.properties[prop]; | ||
| if (value !== undefined) { | ||
| result[prop] = value as any; | ||
|
||
| } | ||
| }); | ||
| return result; | ||
| } | ||
|
|
||
| /** | ||
|
|
||
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.
Some context comment would be nice for touch events, which would be nicer as touch-events.kdl: