docs/Script API/classes/Frontend_Script_API.BasicWidget.html
This is the base widget for all other widgets.
For information on using widgets, see the tutorial {@tutorial widget_basics}.
_noteId_position$widgetattrschildrencomponentIdinitializedparent?
callMethodcanBeShownchildclasscleanupcollapsiblecontentSizedcsscssBlockdoRenderfillinggetClosestNtxIdgetPositionhandleEventhandleEventInChildrenidisEnabledisHiddenExtisHiddenIntisVisiblelogRenderingErroroptChildoptCssremoverendersetParenttoggleExttoggleInttriggerCommandtriggerEvent
new BasicWidget(): BasicWidget
_noteId: string
_position: number
$widget: JQuery<HTMLElement>
Protectedattrsattrs: Record<string, string>
children: default[]
componentId: string
initialized: null | Promise<void>
Optionalparentparent?: TypedComponent<any>
get position(): number
set position(newPosition: number): void
get sanitizedClassName(): string
callMethod(
fun: (arg: unknown) => Promise<unknown>,
data: unknown,
): undefined | Promise<unknown>
canBeShown(): boolean
child(...components: default[]): BasicWidget
class(className: string): BasicWidget
cleanup(): void
collapsible(): BasicWidget
contentSized(): BasicWidget
css(name: string, value: string): BasicWidget
Sets the CSS attribute of the given name to the given value.
the name of the CSS attribute to set (e.g. padding-left).
the value of the CSS attribute to set (e.g. 12px).
self for chaining.
cssBlock(block: string): BasicWidget
Accepts a string of CSS to add with the widget.
for chaining
doRender(): void
Method used for rendering the widget.
Your class should override this method. The method is expected to create a this.$widget containing jQuery object
filling(): BasicWidget
getClosestNtxId(): undefined | null | string
getPosition(): number
handleEvent<T extends EventNames>(
name: T,
data: EventData<T>,
): undefined | null | Promise<unknown>
handleEventInChildren<T extends EventNames>(
name: T,
data: EventData<T>,
): null | Promise<unknown>
id(id: string): BasicWidget
isEnabled(): undefined | null | boolean
Indicates if the widget is enabled. Widgets are enabled by default. Generally setting this to false will cause the widget not to be displayed, however it will still be available on the DOM but hidden.
whether the widget is enabled.
isHiddenExt(): boolean
isHiddenInt(): boolean
isVisible(): boolean
logRenderingError(e: Error): void
optChild(condition: boolean, ...components: default[]): BasicWidget
Conditionally adds the given components as children to this component.
whether to add the components.
the components to be added as children to this component provided the condition is truthy.
self for chaining.
optCss(condition: boolean, name: string, value: string): BasicWidget
Sets the CSS attribute of the given name to the given value, but only if the condition provided is truthy.
true in order to apply the CSS, false to ignore it.
the name of the CSS attribute to set (e.g. padding-left).
the value of the CSS attribute to set (e.g. 12px).
self for chaining.
remove(): void
render(): JQuery<HTMLElement>
setParent(parent: TypedComponent<any>): BasicWidget
toggleExt(show: undefined | null | boolean | ""): void
toggleInt(show: undefined | null | boolean): void
triggerCommand<K extends keyof CommandMappings>(
name: K,
data?: CommandMappings[K],
): undefined | null | Promise<unknown>
Optionaldata: CommandMappings[K]triggerEvent<T extends EventNames>(
name: T,
data: EventData<T>,
): undefined | null | Promise<unknown>
Member Visibility
ThemeOSLightDark
Constructors constructor Properties _noteId_position$widgetattrschildrencomponentIdinitializedparent Accessors positionsanitizedClassName Methods callMethodcanBeShownchildclasscleanupcollapsiblecontentSizedcsscssBlockdoRenderfillinggetClosestNtxIdgetPositionhandleEventhandleEventInChildrenidisEnabledisHiddenExtisHiddenIntisVisiblelogRenderingErroroptChildoptCssremoverendersetParenttoggleExttoggleInttriggerCommandtriggerEvent