mirror of
https://github.com/Bismuth-Forge/bismuth.git
synced 2024-08-17 12:20:54 +03:00
refactor: 🚨 fix function return type rule
This commit is contained in:
parent
6c586c9033
commit
cc693602f4
@ -24,6 +24,7 @@
|
||||
"rules": {
|
||||
"curly": "error",
|
||||
"@typescript-eslint/no-explicit-any": "off",
|
||||
"@typescript-eslint/explicit-function-return-type": "error",
|
||||
"@typescript-eslint/naming-convention": [
|
||||
"error",
|
||||
{
|
||||
|
@ -153,7 +153,8 @@ export class ConfigImpl implements Config {
|
||||
if (this.kwinApi.KWin.readConfig(configKey, defaultValue))
|
||||
this.layoutOrder.push(layoutClass.id);
|
||||
// TODO: Refactor this: config should not create factories. It is not its responsibility
|
||||
this.layoutFactories[layoutClass.id] = () => new layoutClass(this);
|
||||
this.layoutFactories[layoutClass.id] = (): WindowsLayout =>
|
||||
new layoutClass(this);
|
||||
});
|
||||
|
||||
this.maximizeSoleTile = this.kwinApi.KWin.readConfig(
|
||||
|
@ -67,7 +67,7 @@ export class TilingController implements Controller {
|
||||
/**
|
||||
* Entry point: start tiling window management
|
||||
*/
|
||||
public start() {
|
||||
public start(): void {
|
||||
console.log("Let's get down to bismuth!");
|
||||
|
||||
this.debug.debug(() => "Config: " + this.config);
|
||||
@ -239,11 +239,11 @@ export class TilingController implements Controller {
|
||||
}
|
||||
}
|
||||
|
||||
public onWindowFocused(window: Window) {
|
||||
public onWindowFocused(window: Window): void {
|
||||
window.timestamp = new Date().getTime();
|
||||
}
|
||||
|
||||
public onShortcut(input: Shortcut, data?: any) {
|
||||
public onShortcut(input: Shortcut, data?: any): void {
|
||||
if (this.config.directionalKeyMode === "focus") {
|
||||
switch (input) {
|
||||
case Shortcut.Up:
|
||||
|
@ -172,11 +172,11 @@ export class KWinDriver implements DriverContext {
|
||||
* Bind script to the various KWin events
|
||||
*/
|
||||
public bindEvents(): void {
|
||||
const onNumberScreensChanged = (count: number) => {
|
||||
const onNumberScreensChanged = (count: number): void => {
|
||||
this.controller.onSurfaceUpdate("screens=" + count);
|
||||
};
|
||||
|
||||
const onScreenResized = (screen: number) => {
|
||||
const onScreenResized = (screen: number): void => {
|
||||
const srf = new KWinSurface(
|
||||
screen,
|
||||
this.kwinApi.workspace.currentActivity,
|
||||
@ -188,18 +188,18 @@ export class KWinDriver implements DriverContext {
|
||||
this.controller.onSurfaceUpdate("resized " + srf.toString());
|
||||
};
|
||||
|
||||
const onCurrentActivityChanged = (_activity: string) => {
|
||||
const onCurrentActivityChanged = (_activity: string): void => {
|
||||
this.controller.onCurrentSurfaceChanged();
|
||||
};
|
||||
|
||||
const onCurrentDesktopChanged = (
|
||||
_desktop: number,
|
||||
_client: KWin.Client
|
||||
) => {
|
||||
): void => {
|
||||
this.controller.onCurrentSurfaceChanged();
|
||||
};
|
||||
|
||||
const onClientAdded = (client: KWin.Client) => {
|
||||
const onClientAdded = (client: KWin.Client): void => {
|
||||
// NOTE: windowShown can be fired in various situations.
|
||||
// We need only the first one - when window is created.
|
||||
let handled = false;
|
||||
@ -222,7 +222,7 @@ export class KWinDriver implements DriverContext {
|
||||
qmlSetTimeout(handler, 50);
|
||||
};
|
||||
|
||||
const onClientRemoved = (client: KWin.Client) => {
|
||||
const onClientRemoved = (client: KWin.Client): void => {
|
||||
const window = this.windowMap.get(client);
|
||||
if (window) {
|
||||
this.controller.onWindowRemoved(window);
|
||||
@ -234,7 +234,7 @@ export class KWinDriver implements DriverContext {
|
||||
client: KWin.Client,
|
||||
h: boolean,
|
||||
v: boolean
|
||||
) => {
|
||||
): void => {
|
||||
const maximized = h === true && v === true;
|
||||
const window = this.windowMap.get(client);
|
||||
if (window) {
|
||||
@ -247,14 +247,14 @@ export class KWinDriver implements DriverContext {
|
||||
client: KWin.Client,
|
||||
fullScreen: boolean,
|
||||
user: boolean
|
||||
) => {
|
||||
): void => {
|
||||
this.controller.onWindowChanged(
|
||||
this.windowMap.get(client),
|
||||
"fullscreen=" + fullScreen + " user=" + user
|
||||
);
|
||||
};
|
||||
|
||||
const onClientMinimized = (client: KWin.Client) => {
|
||||
const onClientMinimized = (client: KWin.Client): void => {
|
||||
if (this.config.preventMinimize) {
|
||||
client.minimized = false;
|
||||
this.kwinApi.workspace.activeClient = client;
|
||||
@ -265,7 +265,7 @@ export class KWinDriver implements DriverContext {
|
||||
);
|
||||
};
|
||||
|
||||
const onClientUnminimized = (client: KWin.Client) =>
|
||||
const onClientUnminimized = (client: KWin.Client): void =>
|
||||
this.controller.onWindowChanged(
|
||||
this.windowMap.get(client),
|
||||
"unminimized"
|
||||
@ -322,7 +322,7 @@ export class KWinDriver implements DriverContext {
|
||||
* Manage window with the particular KWin clientship
|
||||
* @param client window client object specified by KWin
|
||||
*/
|
||||
private manageWindow(client: KWin.Client) {
|
||||
private manageWindow(client: KWin.Client): void {
|
||||
// Add window to our window map
|
||||
const window = this.windowMap.add(client);
|
||||
|
||||
@ -336,12 +336,12 @@ export class KWinDriver implements DriverContext {
|
||||
this.controller.manageWindow(window);
|
||||
}
|
||||
|
||||
public showNotification(text: string) {
|
||||
public showNotification(text: string): void {
|
||||
this.qml.popupDialog.show(text);
|
||||
}
|
||||
|
||||
private bindMainShortcuts() {
|
||||
const bind = (seq: string, title: string, input: Shortcut) => {
|
||||
private bindMainShortcuts(): void {
|
||||
const bind = (seq: string, title: string, input: Shortcut): void => {
|
||||
title = "Bismuth: " + title;
|
||||
seq = "Meta+" + seq;
|
||||
this.kwinApi.KWin.registerShortcut(title, "", seq, () => {
|
||||
@ -379,12 +379,12 @@ export class KWinDriver implements DriverContext {
|
||||
bind("Return", "Set master", Shortcut.SetMaster);
|
||||
}
|
||||
|
||||
private bindLayoutShortcuts() {
|
||||
private bindLayoutShortcuts(): void {
|
||||
const bind = (
|
||||
seq: string,
|
||||
title: string,
|
||||
layoutClass: WindowsLayoutClass
|
||||
) => {
|
||||
): void => {
|
||||
title = "Bismuth: " + title + " Layout";
|
||||
seq = seq !== "" ? "Meta+" + seq : "";
|
||||
this.kwinApi.KWin.registerShortcut(title, "", seq, () => {
|
||||
@ -408,7 +408,7 @@ export class KWinDriver implements DriverContext {
|
||||
* prevention and auto-disconnect on termination.
|
||||
*/
|
||||
private connect(signal: QSignal, handler: (..._: any[]) => void): () => void {
|
||||
const wrapper = (...args: any[]) => {
|
||||
const wrapper = (...args: any[]): void => {
|
||||
/* HACK: `workspace` become undefined when the script is disabled. */
|
||||
if (typeof this.kwinApi.workspace === "undefined")
|
||||
signal.disconnect(wrapper);
|
||||
@ -443,7 +443,7 @@ export class KWinDriver implements DriverContext {
|
||||
}
|
||||
}
|
||||
|
||||
private bindWindowEvents(window: Window, client: KWin.Client) {
|
||||
private bindWindowEvents(window: Window, client: KWin.Client): void {
|
||||
let moving = false;
|
||||
let resizing = false;
|
||||
|
||||
|
@ -47,13 +47,13 @@ export default class KWinMousePoller {
|
||||
});
|
||||
}
|
||||
|
||||
public start() {
|
||||
public start(): void {
|
||||
this.startCount += 1;
|
||||
if (this.config.pollMouseXdotool)
|
||||
this.qml.mousePoller.connectSource(KWinMousePoller.COMMAND);
|
||||
}
|
||||
|
||||
public stop() {
|
||||
public stop(): void {
|
||||
this.startCount = Math.max(this.startCount - 1, 0);
|
||||
}
|
||||
|
||||
|
@ -21,7 +21,7 @@ export class KWinSurface implements DriverSurface {
|
||||
activity: string,
|
||||
desktop: number,
|
||||
config: Config
|
||||
) {
|
||||
): string {
|
||||
let path = String(screen);
|
||||
if (config.layoutPerActivity) path += "@" + activity;
|
||||
if (config.layoutPerDesktop) path += "#" + desktop;
|
||||
|
@ -26,7 +26,7 @@ export interface DriverWindow {
|
||||
}
|
||||
|
||||
export class KWinWindow implements DriverWindow {
|
||||
public static generateID(client: KWin.Client) {
|
||||
public static generateID(client: KWin.Client): string {
|
||||
return String(client) + "/" + client.windowId;
|
||||
}
|
||||
|
||||
|
@ -87,7 +87,7 @@ export class TilingEngine implements Engine {
|
||||
*
|
||||
* Used when tile is resized using mouse.
|
||||
*/
|
||||
public adjustLayout(basis: Window) {
|
||||
public adjustLayout(basis: Window): void {
|
||||
const srf = basis.surface;
|
||||
const layout = this.layouts.getCurrentLayout(srf);
|
||||
if (layout.adjust) {
|
||||
@ -111,7 +111,7 @@ export class TilingEngine implements Engine {
|
||||
window: Window,
|
||||
dir: "east" | "west" | "south" | "north",
|
||||
step: -1 | 1
|
||||
) {
|
||||
): void {
|
||||
const srf = window.surface;
|
||||
|
||||
// TODO: configurable step size?
|
||||
@ -150,7 +150,7 @@ export class TilingEngine implements Engine {
|
||||
basis: Window,
|
||||
dir: "east" | "west" | "south" | "north",
|
||||
step: -1 | 1
|
||||
) {
|
||||
): void {
|
||||
const srf = basis.surface;
|
||||
|
||||
if (dir === "east") {
|
||||
@ -217,7 +217,7 @@ export class TilingEngine implements Engine {
|
||||
window: Window,
|
||||
dir: "east" | "west" | "south" | "north",
|
||||
step: -1 | 1
|
||||
) {
|
||||
): void {
|
||||
const state = window.state;
|
||||
if (Window.isFloatingState(state)) this.resizeFloat(window, dir, step);
|
||||
else if (Window.isTiledState(state)) this.resizeTile(window, dir, step);
|
||||
@ -239,7 +239,7 @@ export class TilingEngine implements Engine {
|
||||
*
|
||||
* @param screenSurface screen's surface, on which windows should be arranged
|
||||
*/
|
||||
public arrangeScreen(screenSurface: DriverSurface) {
|
||||
public arrangeScreen(screenSurface: DriverSurface): void {
|
||||
const layout = this.layouts.getCurrentLayout(screenSurface);
|
||||
|
||||
const workingArea = screenSurface.workingArea;
|
||||
@ -315,7 +315,7 @@ export class TilingEngine implements Engine {
|
||||
/**
|
||||
* Register the given window to WM.
|
||||
*/
|
||||
public manage(window: Window) {
|
||||
public manage(window: Window): void {
|
||||
if (!window.shouldIgnore) {
|
||||
/* engine#arrange will update the state when required. */
|
||||
window.state = WindowState.Undecided;
|
||||
@ -327,14 +327,14 @@ export class TilingEngine implements Engine {
|
||||
/**
|
||||
* Unregister the given window from WM.
|
||||
*/
|
||||
public unmanage(window: Window) {
|
||||
public unmanage(window: Window): void {
|
||||
this.windows.remove(window);
|
||||
}
|
||||
|
||||
/**
|
||||
* Focus the next or previous window.
|
||||
*/
|
||||
public focusOrder(step: -1 | 1) {
|
||||
public focusOrder(step: -1 | 1): void {
|
||||
const window = this.controller.currentWindow;
|
||||
|
||||
/* if no current window, select the first tile. */
|
||||
@ -372,7 +372,7 @@ export class TilingEngine implements Engine {
|
||||
/**
|
||||
* Focus a neighbor at the given direction.
|
||||
*/
|
||||
public focusDir(dir: Direction) {
|
||||
public focusDir(dir: Direction): void {
|
||||
const window = this.controller.currentWindow;
|
||||
|
||||
/* if no current window, select the first tile. */
|
||||
@ -395,7 +395,7 @@ export class TilingEngine implements Engine {
|
||||
/**
|
||||
* Swap the position of the current window with the next or previous window.
|
||||
*/
|
||||
public swapOrder(window: Window, step: -1 | 1) {
|
||||
public swapOrder(window: Window, step: -1 | 1): void {
|
||||
const srf = window.surface;
|
||||
const visibles = this.windows.getVisibleWindows(srf);
|
||||
if (visibles.length < 2) return;
|
||||
@ -410,7 +410,7 @@ export class TilingEngine implements Engine {
|
||||
/**
|
||||
* Swap the position of the current window with a neighbor at the given direction.
|
||||
*/
|
||||
public swapDirection(dir: Direction) {
|
||||
public swapDirection(dir: Direction): void {
|
||||
const window = this.controller.currentWindow;
|
||||
if (window === null) {
|
||||
/* if no current window, select the first tile. */
|
||||
@ -432,7 +432,7 @@ export class TilingEngine implements Engine {
|
||||
* @param window a floating window
|
||||
* @param dir which direction
|
||||
*/
|
||||
public moveFloat(window: Window, dir: Direction) {
|
||||
public moveFloat(window: Window, dir: Direction): void {
|
||||
const srf = window.surface;
|
||||
|
||||
// TODO: configurable step size?
|
||||
@ -462,7 +462,7 @@ export class TilingEngine implements Engine {
|
||||
window.forceSetGeometry(new Rect(x, y, geometry.width, geometry.height));
|
||||
}
|
||||
|
||||
public swapDirOrMoveFloat(dir: Direction) {
|
||||
public swapDirOrMoveFloat(dir: Direction): void {
|
||||
const window = this.controller.currentWindow;
|
||||
if (!window) return;
|
||||
|
||||
@ -474,7 +474,7 @@ export class TilingEngine implements Engine {
|
||||
/**
|
||||
* Toggle float mode of window.
|
||||
*/
|
||||
public toggleFloat(window: Window) {
|
||||
public toggleFloat(window: Window): void {
|
||||
window.state = !window.tileable ? WindowState.Tiled : WindowState.Floating;
|
||||
}
|
||||
|
||||
@ -485,7 +485,7 @@ export class TilingEngine implements Engine {
|
||||
* windows: windows will be tiled if more than half are floating, and will
|
||||
* be floated otherwise.
|
||||
*/
|
||||
public floatAll(srf: DriverSurface) {
|
||||
public floatAll(srf: DriverSurface): void {
|
||||
const windows = this.windows.getVisibleWindows(srf);
|
||||
const numFloats = windows.reduce<number>((count, window) => {
|
||||
return window.state === WindowState.Floating ? count + 1 : count;
|
||||
@ -513,14 +513,14 @@ export class TilingEngine implements Engine {
|
||||
* Some layouts depend on this assumption, and will make such windows more
|
||||
* visible than others.
|
||||
*/
|
||||
public setMaster(window: Window) {
|
||||
public setMaster(window: Window): void {
|
||||
this.windows.setMaster(window);
|
||||
}
|
||||
|
||||
/**
|
||||
* Change the layout of the current surface to the next.
|
||||
*/
|
||||
public cycleLayout(step: 1 | -1) {
|
||||
public cycleLayout(step: 1 | -1): void {
|
||||
const layout = this.layouts.cycleLayout(
|
||||
this.controller.currentSurface,
|
||||
step
|
||||
@ -533,7 +533,7 @@ export class TilingEngine implements Engine {
|
||||
/**
|
||||
* Set the layout of the current surface to the specified layout.
|
||||
*/
|
||||
public setLayout(layoutClassID: string) {
|
||||
public setLayout(layoutClassID: string): void {
|
||||
const layout = this.layouts.setLayout(
|
||||
this.controller.currentSurface,
|
||||
layoutClassID
|
||||
@ -586,19 +586,19 @@ export class TilingEngine implements Engine {
|
||||
.getVisibleTiles(this.controller.currentSurface)
|
||||
.filter(
|
||||
vertical
|
||||
? (tile) => tile.geometry.y * sign > basis.geometry.y * sign
|
||||
: (tile) => tile.geometry.x * sign > basis.geometry.x * sign
|
||||
? (tile): boolean => tile.geometry.y * sign > basis.geometry.y * sign
|
||||
: (tile): boolean => tile.geometry.x * sign > basis.geometry.x * sign
|
||||
)
|
||||
.filter(
|
||||
vertical
|
||||
? (tile) =>
|
||||
? (tile): boolean =>
|
||||
overlap(
|
||||
basis.geometry.x,
|
||||
basis.geometry.maxX,
|
||||
tile.geometry.x,
|
||||
tile.geometry.maxX
|
||||
)
|
||||
: (tile) =>
|
||||
: (tile): boolean =>
|
||||
overlap(
|
||||
basis.geometry.y,
|
||||
basis.geometry.maxY,
|
||||
@ -620,8 +620,8 @@ export class TilingEngine implements Engine {
|
||||
|
||||
const closest = candidates.filter(
|
||||
vertical
|
||||
? (tile) => tile.geometry.y === min
|
||||
: (tile) => tile.geometry.x === min
|
||||
? (tile): boolean => tile.geometry.y === min
|
||||
: (tile): boolean => tile.geometry.x === min
|
||||
);
|
||||
|
||||
return closest.sort((a, b) => b.timestamp - a.timestamp)[0];
|
||||
|
@ -54,7 +54,7 @@ export default class CascadeLayout implements WindowsLayout {
|
||||
|
||||
public readonly classID = CascadeLayout.id;
|
||||
|
||||
public get description() {
|
||||
public get description(): string {
|
||||
return "Cascade [" + CascadeDirection[this.dir] + "]";
|
||||
}
|
||||
|
||||
|
@ -57,7 +57,7 @@ export default class SpreadLayout implements WindowsLayout {
|
||||
return other;
|
||||
}
|
||||
|
||||
public handleShortcut(_engine: Engine, input: Shortcut) {
|
||||
public handleShortcut(_engine: Engine, input: Shortcut): boolean {
|
||||
switch (input) {
|
||||
case Shortcut.Decrease:
|
||||
// TODO: define arbitrary constants
|
||||
|
@ -54,7 +54,7 @@ export default class StairLayout implements WindowsLayout {
|
||||
return other;
|
||||
}
|
||||
|
||||
public handleShortcut(_engine: Engine, input: Shortcut) {
|
||||
public handleShortcut(_engine: Engine, input: Shortcut): boolean {
|
||||
switch (input) {
|
||||
case Shortcut.Decrease:
|
||||
// TODO: define arbitrary constants
|
||||
|
@ -72,7 +72,12 @@ export default class TileLayout implements WindowsLayout {
|
||||
this.config.tileLayoutGap;
|
||||
}
|
||||
|
||||
public adjust(area: Rect, tiles: Window[], basis: Window, delta: RectDelta) {
|
||||
public adjust(
|
||||
area: Rect,
|
||||
tiles: Window[],
|
||||
basis: Window,
|
||||
delta: RectDelta
|
||||
): void {
|
||||
this.parts.adjust(area, tiles, basis, delta);
|
||||
}
|
||||
|
||||
@ -91,7 +96,7 @@ export default class TileLayout implements WindowsLayout {
|
||||
return other;
|
||||
}
|
||||
|
||||
public handleShortcut(engine: Engine, input: Shortcut) {
|
||||
public handleShortcut(engine: Engine, input: Shortcut): boolean {
|
||||
switch (input) {
|
||||
case Shortcut.Left:
|
||||
this.masterRatio = clip(
|
||||
|
@ -207,7 +207,7 @@ export default class Window {
|
||||
* This method is a quick hack created for engine#resizeFloat, thus should
|
||||
* not be used in other places.
|
||||
*/
|
||||
public forceSetGeometry(geometry: Rect) {
|
||||
public forceSetGeometry(geometry: Rect): void {
|
||||
this.window.commit(geometry);
|
||||
}
|
||||
|
||||
|
@ -14,7 +14,7 @@ export default class WindowStore {
|
||||
this.list = windows || [];
|
||||
}
|
||||
|
||||
public move(srcWin: Window, destWin: Window, after?: boolean) {
|
||||
public move(srcWin: Window, destWin: Window, after?: boolean): void {
|
||||
const srcIdx = this.list.indexOf(srcWin);
|
||||
const destIdx = this.list.indexOf(destWin);
|
||||
if (srcIdx === -1 || destIdx === -1) return;
|
||||
@ -23,14 +23,14 @@ export default class WindowStore {
|
||||
this.list.splice(after ? destIdx + 1 : destIdx, 0, srcWin);
|
||||
}
|
||||
|
||||
public setMaster(window: Window) {
|
||||
public setMaster(window: Window): void {
|
||||
const idx = this.list.indexOf(window);
|
||||
if (idx === -1) return;
|
||||
this.list.splice(idx, 1);
|
||||
this.list.splice(0, 0, window);
|
||||
}
|
||||
|
||||
public swap(alpha: Window, beta: Window) {
|
||||
public swap(alpha: Window, beta: Window): void {
|
||||
const alphaIndex = this.list.indexOf(alpha);
|
||||
const betaIndex = this.list.indexOf(beta);
|
||||
if (alphaIndex < 0 || betaIndex < 0) return;
|
||||
@ -45,24 +45,24 @@ export default class WindowStore {
|
||||
return this.list.length;
|
||||
}
|
||||
|
||||
public at(idx: number) {
|
||||
public at(idx: number): Window {
|
||||
return this.list[idx];
|
||||
}
|
||||
|
||||
public indexOf(window: Window) {
|
||||
public indexOf(window: Window): number {
|
||||
return this.list.indexOf(window);
|
||||
}
|
||||
|
||||
public push(window: Window) {
|
||||
public push(window: Window): void {
|
||||
this.list.push(window);
|
||||
}
|
||||
|
||||
public remove(window: Window) {
|
||||
public remove(window: Window): void {
|
||||
const idx = this.list.indexOf(window);
|
||||
if (idx >= 0) this.list.splice(idx, 1);
|
||||
}
|
||||
|
||||
public unshift(window: Window) {
|
||||
public unshift(window: Window): void {
|
||||
this.list.unshift(window);
|
||||
}
|
||||
//#endregion
|
||||
|
@ -11,7 +11,10 @@ import Debug from "./util/debug";
|
||||
* @param qmlObjects objects from QML gui. Required for the interaction with QML, as we cannot access globals.
|
||||
* @param kwinApi KWin scripting API. Required for interaction with KWin, as we cannot access globals.
|
||||
*/
|
||||
export function init(qmlObjects: Bismuth.Qml.Main, kwinScriptingApi: KWin.Api) {
|
||||
export function init(
|
||||
qmlObjects: Bismuth.Qml.Main,
|
||||
kwinScriptingApi: KWin.Api
|
||||
): void {
|
||||
const config = new ConfigImpl(kwinScriptingApi);
|
||||
const debug = new Debug(config);
|
||||
|
||||
|
@ -5,10 +5,10 @@
|
||||
|
||||
import Rect from "./rect";
|
||||
|
||||
export function toQRect(rect: Rect) {
|
||||
export function toQRect(rect: Rect): QRect {
|
||||
return Qt.rect(rect.x, rect.y, rect.width, rect.height);
|
||||
}
|
||||
|
||||
export function toRect(qrect: QRect) {
|
||||
export function toRect(qrect: QRect): Rect {
|
||||
return new Rect(qrect.x, qrect.y, qrect.width, qrect.height);
|
||||
}
|
||||
|
@ -22,7 +22,7 @@ export class TimersPool {
|
||||
* Get an instance of timer pool.
|
||||
* @param scriptRoot where to create QML Timers. Cannot be ommited in the first call.
|
||||
*/
|
||||
public static instance(scriptRoot?: object, debug?: Debug) {
|
||||
public static instance(scriptRoot?: object, debug?: Debug): TimersPool {
|
||||
if (scriptRoot && debug) {
|
||||
if (TimersPool._instance) {
|
||||
return TimersPool._instance;
|
||||
@ -63,7 +63,7 @@ export class TimersPool {
|
||||
this.numTimers = 0;
|
||||
}
|
||||
|
||||
public setTimeout(func: () => void, timeout: number) {
|
||||
public setTimeout(func: () => void, timeout: number): void {
|
||||
if (this.timers.length === 0) {
|
||||
this.numTimers++;
|
||||
this.debug.debugObj(() => [
|
||||
@ -76,7 +76,7 @@ export class TimersPool {
|
||||
this.timers.pop() ||
|
||||
Qt.createQmlObject("import QtQuick 2.0; Timer {}", this.scriptRoot);
|
||||
|
||||
const callback = () => {
|
||||
const callback = (): void => {
|
||||
try {
|
||||
timer.triggered.disconnect(callback);
|
||||
} catch (e) {
|
||||
@ -100,6 +100,6 @@ export class TimersPool {
|
||||
/**
|
||||
* setTimeout from standard JS, but for Qt JS Runtime
|
||||
*/
|
||||
export default function qmlSetTimeout(func: () => void, timeout: number) {
|
||||
export default function qmlSetTimeout(func: () => void, timeout: number): void {
|
||||
TimersPool.instance().setTimeout(func, timeout);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user