chore: remove deprecated scroll-touch-{begin,end,edge} events (#39814)

* chore: remove deprecated `scroll-touch-{begin,end,edge}` events

* update spec/ts-smoke

---------

Co-authored-by: John Kleinschmidt <jkleinsc@electronjs.org>
This commit is contained in:
Milan Burda 2023-09-20 23:41:29 +02:00 committed by GitHub
parent 58fd8825d2
commit c9eb3deab5
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 7 additions and 53 deletions

View file

@ -1,6 +1,5 @@
import { BaseWindow, WebContents, BrowserView, TouchBar } from 'electron/main';
import type { BrowserWindow as BWT } from 'electron/main';
import * as deprecate from '@electron/internal/common/deprecate';
const { BrowserWindow } = process._linkedBinding('electron_browser_window') as { BrowserWindow: typeof BWT };
Object.setPrototypeOf(BrowserWindow.prototype, BaseWindow.prototype);
@ -53,28 +52,6 @@ BrowserWindow.prototype._init = function (this: BWT) {
this.on(event as any, visibilityChanged);
}
const warn = deprecate.warnOnceMessage('\'scroll-touch-{begin,end,edge}\' are deprecated and will be removed. Please use the WebContents \'input-event\' event instead.');
this.webContents.on('input-event', (_, e) => {
if (e.type === 'gestureScrollBegin') {
if (this.listenerCount('scroll-touch-begin') !== 0) {
warn();
this.emit('scroll-touch-edge');
this.emit('scroll-touch-begin');
}
} else if (e.type === 'gestureScrollUpdate') {
if (this.listenerCount('scroll-touch-edge') !== 0) {
warn();
this.emit('scroll-touch-edge');
}
} else if (e.type === 'gestureScrollEnd') {
if (this.listenerCount('scroll-touch-end') !== 0) {
warn();
this.emit('scroll-touch-edge');
this.emit('scroll-touch-end');
}
}
});
// Notify the creation of the window.
app.emit('browser-window-created', { preventDefault () {} }, this);