mirror of
https://github.com/microsoft/vscode.git
synced 2026-04-25 11:08:51 +01:00
Prevent back/forward gestures on macos
This commit is contained in:
@@ -205,14 +205,14 @@ class DomListener implements IDisposable {
|
||||
private _handler: (e: any) => void;
|
||||
private _node: Element | Window | Document;
|
||||
private readonly _type: string;
|
||||
private readonly _useCapture: boolean;
|
||||
private readonly _options: boolean | AddEventListenerOptions;
|
||||
|
||||
constructor(node: Element | Window | Document, type: string, handler: (e: any) => void, useCapture?: boolean) {
|
||||
constructor(node: Element | Window | Document, type: string, handler: (e: any) => void, options?: boolean | AddEventListenerOptions) {
|
||||
this._node = node;
|
||||
this._type = type;
|
||||
this._handler = handler;
|
||||
this._useCapture = (useCapture || false);
|
||||
this._node.addEventListener(this._type, this._handler, this._useCapture);
|
||||
this._options = (options || false);
|
||||
this._node.addEventListener(this._type, this._handler, this._options);
|
||||
}
|
||||
|
||||
public dispose(): void {
|
||||
@@ -221,7 +221,7 @@ class DomListener implements IDisposable {
|
||||
return;
|
||||
}
|
||||
|
||||
this._node.removeEventListener(this._type, this._handler, this._useCapture);
|
||||
this._node.removeEventListener(this._type, this._handler, this._options);
|
||||
|
||||
// Prevent leakers from holding on to the dom or handler func
|
||||
this._node = null!;
|
||||
@@ -231,7 +231,8 @@ class DomListener implements IDisposable {
|
||||
|
||||
export function addDisposableListener<K extends keyof GlobalEventHandlersEventMap>(node: Element | Window | Document, type: K, handler: (event: GlobalEventHandlersEventMap[K]) => void, useCapture?: boolean): IDisposable;
|
||||
export function addDisposableListener(node: Element | Window | Document, type: string, handler: (event: any) => void, useCapture?: boolean): IDisposable;
|
||||
export function addDisposableListener(node: Element | Window | Document, type: string, handler: (event: any) => void, useCapture?: boolean): IDisposable {
|
||||
export function addDisposableListener(node: Element | Window | Document, type: string, handler: (event: any) => void, useCapture: AddEventListenerOptions): IDisposable;
|
||||
export function addDisposableListener(node: Element | Window | Document, type: string, handler: (event: any) => void, useCapture?: boolean | AddEventListenerOptions): IDisposable {
|
||||
return new DomListener(node, type, handler, useCapture);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user