Add types file in API
This commit is contained in:
parent
a195870cfb
commit
706f531ca2
5 changed files with 11 additions and 13 deletions
|
@ -7,7 +7,7 @@ import { Popup } from "./Ui/Popup";
|
|||
import { ActionMessage } from "./Ui/ActionMessage";
|
||||
import { isMessageReferenceEvent } from "../Events/ui/TriggerActionMessageEvent";
|
||||
import { Menu } from "./Ui/Menu";
|
||||
import type { RequireOnlyOne } from "../../types";
|
||||
import type { RequireOnlyOne } from "../types";
|
||||
|
||||
let popupId = 0;
|
||||
const popups: Map<number, Popup> = new Map<number, Popup>();
|
||||
|
@ -26,7 +26,7 @@ interface MenuDescriptor {
|
|||
allowApi?: boolean;
|
||||
}
|
||||
|
||||
type CallbackOrIframe = RequireOnlyOne<MenuDescriptor, "callback" | "iframe">;
|
||||
export type MenuOptions = RequireOnlyOne<MenuDescriptor, "callback" | "iframe">;
|
||||
|
||||
interface ZonedPopupOptions {
|
||||
zone: string;
|
||||
|
@ -119,10 +119,7 @@ export class WorkAdventureUiCommands extends IframeApiContribution<WorkAdventure
|
|||
return popup;
|
||||
}
|
||||
|
||||
registerMenuCommand(
|
||||
commandDescriptor: string,
|
||||
options: CallbackOrIframe | ((commandDescriptor: string) => void)
|
||||
): Menu {
|
||||
registerMenuCommand(commandDescriptor: string, options: MenuOptions | ((commandDescriptor: string) => void)): Menu {
|
||||
const menu = new Menu(commandDescriptor);
|
||||
|
||||
if (typeof options === "function") {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue