Skip to content
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

fix(whatInput): Type event listeners #20024

Merged
merged 2 commits into from
Sep 29, 2021
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions packages/fluentui/react-northstar/src/utils/whatInput.ts
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,8 @@ const setUp = () => {
doUpdate(window.document);
};

type WhatInputEvents = MouseEvent | TouchEvent | KeyboardEvent;

/*
* events
*/
Expand Down Expand Up @@ -107,7 +109,7 @@ const addListeners = (eventTarget: Window) => {
};

// checks conditions before updating new input
const setInput = event => {
const setInput = (event: WhatInputEvents) => {
// only execute if the event buffer timer isn't running
if (!isBuffering) {
const eventKey = event.which;
Expand All @@ -133,7 +135,7 @@ const doUpdate = (target: Document) => {
};

// buffers events that frequently also fire mouse events
const eventBuffer = event => {
const eventBuffer = (event: WhatInputEvents) => {
// set the current input
setInput(event);

Expand Down