chore: remove deprecated getTrafficLightPosition() / setTrafficLightPosition() (#39479)

chore: remove deprecated getTrafficLightPosition() / setTrafficLightPosition()
This commit is contained in:
Milan Burda 2023-08-21 15:58:09 +02:00 committed by GitHub
parent 3a91d1f1e1
commit 90865fa97d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 40 additions and 79 deletions

View file

@ -1,6 +1,5 @@
import { EventEmitter } from 'events';
import type { BaseWindow as TLWT } from 'electron/main';
import * as deprecate from '@electron/internal/common/deprecate';
const { BaseWindow } = process._linkedBinding('electron_browser_base_window') as { BaseWindow: typeof TLWT };
Object.setPrototypeOf(BaseWindow.prototype, EventEmitter.prototype);
@ -16,25 +15,6 @@ BaseWindow.prototype._init = function () {
}
};
// Deprecation.
const setTrafficLightPositionDeprecated = deprecate.warnOnce('setTrafficLightPosition', 'setWindowButtonPosition');
// Converting to any as the methods are defined under BrowserWindow in our docs.
(BaseWindow as any).prototype.setTrafficLightPosition = function (pos: Electron.Point) {
setTrafficLightPositionDeprecated();
if (typeof pos === 'object' && pos.x === 0 && pos.y === 0) {
this.setWindowButtonPosition(null);
} else {
this.setWindowButtonPosition(pos);
}
};
const getTrafficLightPositionDeprecated = deprecate.warnOnce('getTrafficLightPosition', 'getWindowButtonPosition');
(BaseWindow as any).prototype.getTrafficLightPosition = function () {
getTrafficLightPositionDeprecated();
const pos = this.getWindowButtonPosition();
return pos === null ? { x: 0, y: 0 } : pos;
};
// Properties
Object.defineProperty(BaseWindow.prototype, 'autoHideMenuBar', {