An interface for managing MindDrop's theme.
Hooks provide access to themes from inside React components. Unlike resources accessed using static methods, hooks will cause the component to rerender when the data changes.
Returns the theme's current appearance.
useAppearance(): ThemeAppearance
Returns the theme's current appearance setting.
useAppearance(): ThemeAppearanceSetting
Returns the theme's current appearance.
Theme.getAppearance(): ThemeAppearance
Sets the theme's current appearance. Dispatches a theme:appearance:set-value
event.
Theme.setAppearance(core: Core, value: ThemeAppearance): void
Argument | Type | Description |
---|---|---|
core* | Core | A MindDrop core instance. |
value* | ThemeAppearance | The theme's current appearance. |
Returns the theme's appearance setting.
Theme.getAppearanceSetting(): ThemeAppearanceSetting
Sets the theme's appearance setting. Dispatches a theme:appearance:set-setting
event.
Theme.setAppearanceSetting(core: Core, value: ThemeAppearanceSetting): void
Argument | Type | Description |
---|---|---|
core* | Core | A MindDrop core instance. |
value* | ThemeAppearanceSetting | The theme's appearance setting. |
Adds theme specific event listeners. Equivalent to calling addEventListener
directly on core
, but provides more advanced type definitions.
Theme.addEventListener(core: Core, event: ThemeEvent, callback: EventListenerCallback): void
Argument | Type | Description |
---|---|---|
core* | Core | A MindDrop core instance. |
event* | ThemeEvent | The event type to listen for. See the theme events section below for available events. |
callback* | EventListenerCallback | The callback fired when the event occurs. See the theme events section below for the data passed to the callback. |
Removes theme specific event listeners. Equivalent to calling removeEventListener
directly on core
, but provides more advanced type definitions.
Themes.removeEventListener(core: Core, event: ThemeEvent, callback: EventListenerCallback): void
Argument | Type | Description |
---|---|---|
core* | Core | A MindDrop core instance. |
event* | ThemeEvent | The event type for which to remove the event listener. |
callback* | EventListenerCallback | The callback of the event listener to remove. |
See below the table for more details on the data passed by theme related events.
Name | Data | Description |
---|---|---|
theme:appearance:set-value | ThemeAppearance | Dispatched when the theme appearance is changed. |
theme:appearance:set-setting | ThemeAppearanceSetting | Dispatched when the theme appearance setting is changed. |
Theme events are dispatched with one of the following types of data.
The current theme appearance. See the Theme interface page for more details.
The theme appearance setting. See the Theme interface page for more details.