Skip to main content

PreferenceExtensionsSettingItem

Preference Menu info for extensions settings

Index

Properties

ButtonText

ButtonText: string | () => string

The label for the extension button. If it's a Function, it will be called once when entering the extension setting menu. Use the return value as button text.

Identifier

Identifier: string

The identifier of the extension. This is used to identify the extension and must be unique.

optionalImage

Image?: string | () => string

The image path of the extension.

This is passed to DrawButton directly. You can use a data URL here.

If it's a Function, it will be called once when entering the extension setting menu. Use the return value as image path. If it's undefined, there will be no image for the button

click

click: () => void

Called when a click happens on the extension screen.

Note: your exit button handling must call PreferenceSubscreenExit;


Type declaration

    • (): void
    • Returns void

exit

exit: () => boolean | void

Called when the extension screen is about to exit.

Happens either through a click of the exit button, or the ESC key.

@returns

If you have some validation that needs to happen (for example, ensuring that a textfield contains a valid color code), return false; this will stop the subscreen from exiting. You might want to show a message to the user explaining why "nothing is happening" in that case, either through your own means or by setting PreferenceMessage to a string.

If you return true or nothing, your screen's PreferenceExtensionsSettingItem.unload handler will be called afterward.


Type declaration

    • (): boolean | void
    • Returns boolean | void

optionalload

load?: () => void

Called when the extension screen is about to be displayed.

You can create your own HTML elements in here, or load your data.

Note that HTML elements with the HideOnPopup class will be hidden automatically when a popup is shown.


Type declaration

    • (): void
    • Returns void

run

run: () => void

Called every frame while the extension screen is shown.


Type declaration

    • (): void
    • Returns void

optionalunload

unload?: () => void

Called when the extension screen is about to be closed.

Handles the unloading of the extension setting, usually when the user clicks the exit button, but it can also be called by the relog screen being triggered because of a disconnect.

If you created any HTML elements in PreferenceExtensionsSettingItem.load, this is a good place to remove them.


Type declaration

    • (): void
    • Returns void