mirror of
https://github.com/microsoft/vscode.git
synced 2026-04-22 01:29:04 +01:00
This commit is contained in:
@@ -825,6 +825,12 @@ export interface EventLike {
|
||||
stopPropagation(): void;
|
||||
}
|
||||
|
||||
export function isEventLike(obj: unknown): obj is EventLike {
|
||||
const candidate = obj as EventLike | undefined;
|
||||
|
||||
return !!(candidate && typeof candidate.preventDefault === 'function' && typeof candidate.stopPropagation === 'function');
|
||||
}
|
||||
|
||||
export const EventHelper = {
|
||||
stop: <T extends EventLike>(e: T, cancelBubble?: boolean): T => {
|
||||
e.preventDefault();
|
||||
|
||||
Reference in New Issue
Block a user