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:
parent
58fd8825d2
commit
c9eb3deab5
3 changed files with 7 additions and 53 deletions
|
@ -367,36 +367,6 @@ The following app commands are explicitly supported on Linux:
|
||||||
* `browser-backward`
|
* `browser-backward`
|
||||||
* `browser-forward`
|
* `browser-forward`
|
||||||
|
|
||||||
#### Event: 'scroll-touch-begin' _macOS_ _Deprecated_
|
|
||||||
|
|
||||||
Emitted when scroll wheel event phase has begun.
|
|
||||||
|
|
||||||
> **Note**
|
|
||||||
> This event is deprecated beginning in Electron 22.0.0. See [Breaking
|
|
||||||
> Changes](../breaking-changes.md#deprecated-browserwindow-scroll-touch--events)
|
|
||||||
> for details of how to migrate to using the [WebContents
|
|
||||||
> `input-event`](./web-contents.md#event-input-event) event.
|
|
||||||
|
|
||||||
#### Event: 'scroll-touch-end' _macOS_ _Deprecated_
|
|
||||||
|
|
||||||
Emitted when scroll wheel event phase has ended.
|
|
||||||
|
|
||||||
> **Note**
|
|
||||||
> This event is deprecated beginning in Electron 22.0.0. See [Breaking
|
|
||||||
> Changes](../breaking-changes.md#deprecated-browserwindow-scroll-touch--events)
|
|
||||||
> for details of how to migrate to using the [WebContents
|
|
||||||
> `input-event`](./web-contents.md#event-input-event) event.
|
|
||||||
|
|
||||||
#### Event: 'scroll-touch-edge' _macOS_ _Deprecated_
|
|
||||||
|
|
||||||
Emitted when scroll wheel event phase filed upon reaching the edge of element.
|
|
||||||
|
|
||||||
> **Note**
|
|
||||||
> This event is deprecated beginning in Electron 22.0.0. See [Breaking
|
|
||||||
> Changes](../breaking-changes.md#deprecated-browserwindow-scroll-touch--events)
|
|
||||||
> for details of how to migrate to using the [WebContents
|
|
||||||
> `input-event`](./web-contents.md#event-input-event) event.
|
|
||||||
|
|
||||||
#### Event: 'swipe' _macOS_
|
#### Event: 'swipe' _macOS_
|
||||||
|
|
||||||
Returns:
|
Returns:
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
import { BaseWindow, WebContents, BrowserView, TouchBar } from 'electron/main';
|
import { BaseWindow, WebContents, BrowserView, TouchBar } from 'electron/main';
|
||||||
import type { BrowserWindow as BWT } 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 };
|
const { BrowserWindow } = process._linkedBinding('electron_browser_window') as { BrowserWindow: typeof BWT };
|
||||||
|
|
||||||
Object.setPrototypeOf(BrowserWindow.prototype, BaseWindow.prototype);
|
Object.setPrototypeOf(BrowserWindow.prototype, BaseWindow.prototype);
|
||||||
|
@ -53,28 +52,6 @@ BrowserWindow.prototype._init = function (this: BWT) {
|
||||||
this.on(event as any, visibilityChanged);
|
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.
|
// Notify the creation of the window.
|
||||||
app.emit('browser-window-created', { preventDefault () {} }, this);
|
app.emit('browser-window-created', { preventDefault () {} }, this);
|
||||||
|
|
||||||
|
|
|
@ -1284,6 +1284,13 @@ win4.loadURL('http://github.com');
|
||||||
// @ts-expect-error Removed API
|
// @ts-expect-error Removed API
|
||||||
win4.webContents.getPrinters();
|
win4.webContents.getPrinters();
|
||||||
|
|
||||||
|
// @ts-expect-error Removed API
|
||||||
|
win4.webContents.on('scroll-touch-begin', () => {});
|
||||||
|
// @ts-expect-error Removed API
|
||||||
|
win4.webContents.on('scroll-touch-edge', () => {});
|
||||||
|
// @ts-expect-error Removed API
|
||||||
|
win4.webContents.on('scroll-touch-end', () => {});
|
||||||
|
|
||||||
// TouchBar
|
// TouchBar
|
||||||
// https://github.com/electron/electron/blob/main/docs/api/touch-bar.md
|
// https://github.com/electron/electron/blob/main/docs/api/touch-bar.md
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue