mirror of
https://github.com/tobspr/shapez.io.git
synced 2026-03-02 03:39:21 +00:00
Add type hints to signals
This commit is contained in:
@@ -90,18 +90,6 @@ export class BaseHUDPart {
|
||||
|
||||
// Helpers
|
||||
|
||||
/**
|
||||
* Calls closeMethod if an overlay is opened
|
||||
* @param {function=} closeMethod
|
||||
*/
|
||||
closeOnOverlayOpen(closeMethod = null) {
|
||||
this.root.hud.signals.overlayOpened.add(overlay => {
|
||||
if (overlay !== this) {
|
||||
(closeMethod || this.close).call(this);
|
||||
}
|
||||
}, this);
|
||||
}
|
||||
|
||||
/**
|
||||
* Helper method to construct a new click detector
|
||||
* @param {Element} element The element to listen on
|
||||
|
||||
@@ -16,6 +16,7 @@ import { IS_MOBILE } from "../../core/config";
|
||||
import { HUDMassSelector } from "./parts/mass_selector";
|
||||
import { HUDVignetteOverlay } from "./parts/vignette_overlay";
|
||||
import { HUDStatistics } from "./parts/statistics";
|
||||
import { MetaBuilding } from "../meta_building";
|
||||
|
||||
export class GameHUD {
|
||||
/**
|
||||
@@ -29,10 +30,6 @@ export class GameHUD {
|
||||
* Initializes the hud parts
|
||||
*/
|
||||
initialize() {
|
||||
this.signals = {
|
||||
overlayOpened: new Signal(/* overlay */),
|
||||
};
|
||||
|
||||
this.parts = {
|
||||
processingOverlay: new HUDProcessingOverlay(this.root),
|
||||
|
||||
@@ -54,7 +51,7 @@ export class GameHUD {
|
||||
};
|
||||
|
||||
this.signals = {
|
||||
selectedPlacementBuildingChanged: new Signal(/* metaBuilding|null */),
|
||||
selectedPlacementBuildingChanged: /** @type {TypedSignal<[MetaBuilding|null]>} */ (new Signal()),
|
||||
};
|
||||
|
||||
if (!IS_MOBILE) {
|
||||
|
||||
Reference in New Issue
Block a user