-
Notifications
You must be signed in to change notification settings - Fork 22
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
#3347: include trigger event data #3348
Conversation
Codecov Report
@@ Coverage Diff @@
## main #3348 +/- ##
==========================================
- Coverage 36.86% 36.85% -0.02%
==========================================
Files 751 751
Lines 21520 21527 +7
Branches 4600 4602 +2
==========================================
Hits 7934 7934
- Misses 12669 12675 +6
- Partials 917 918 +1
Continue to review full report at Codecov.
|
@@ -196,6 +216,7 @@ export abstract class TriggerExtensionPoint extends ExtensionPoint<TriggerConfig | |||
*/ | |||
// Can't set in constructor because the constructor doesn't have access to debounceOptions | |||
private debouncedRunTriggersAndNotify?: ( | |||
nativeEvent: Event | null, | |||
...roots: ReaderRoot[] |
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.
If you turn this into a non-spread array you can have it as the first parameter. This way you don't have to pass around NO_NATIVE_EVENT since it's the second parameter and can be empty. It's slightly less convenient but IMHO better than an optional first parameter.
- await this.debouncedRunTriggersAndNotify(NO_NATIVE_EVENT, ...$root);
+ await this.debouncedRunTriggersAndNotify($root.get()); // jQuery -> Array
- void this.debouncedRunTriggersAndNotify(NO_NATIVE_EVENT, element);
+ void this.debouncedRunTriggersAndNotify([element]); // Single element -> Array
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 swapped the order and made an object for nullable params. I kept the param as non-optional because I want to make the behavior very explicit for readability
@@ -155,6 +159,22 @@ async function interval({ | |||
console.debug("interval:completed"); | |||
} | |||
|
|||
function pickEventProperties(nativeEvent: Event): UnknownObject { |
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 could be typed:
function pickEventProperties(nativeEvent: Event): UnknownObject { | |
function pickEventProperties(nativeEvent: Event): SerializableKeyboardEvent | null { |
interface SerializableKeyboardEvent {
key: number;
keyCode: number;
metaKey: boolean;
altKey: boolean;
shiftKey: boolean;
ctrlKey: boolean;
}
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 could be typed
I don't think there's much value in typing it yet because the caller doesn't care what it gets back as long as it's serializable. The return type should be JsonObject. But pick
s type signature isn't precise enough to support that
What does this PR do?
Out of Scope