Blockly. ThemeManager
Constructor
ThemeManager
new ThemeManager(workspace, theme)
Class for storing and updating a workspace's theme and UI components.
Parameter |
|
---|---|
workspace |
The main workspace. Value must not be null. |
theme |
The workspace theme. Value must not be null. |
Methods
dispose
dispose()
Dispose of this theme manager.
getTheme
getTheme() returns Blockly.Theme
Get the workspace theme.
- Returns
-
non-null Blockly.Theme
The workspace theme.
setTheme
setTheme(theme)
Set the workspace theme, and refresh the workspace and all components.
Parameter |
|
---|---|
theme |
The workspace theme. Value must not be null. |
subscribe
subscribe(element, componentName, propertyName)
Subscribe an element to changes to the selected theme. If a new theme is selected, the element's style is refreshed with the new theme's style.
Parameter |
|
---|---|
element |
Element The element to subscribe. Value must not be null. |
componentName |
string The name used to identify the component. This must be the same name used to configure the style in the Theme object. |
propertyName |
string The inline style property name to update. |
subscribeWorkspace
subscribeWorkspace(workspace)
Subscribe a workspace to changes to the selected theme. If a new theme is set, the workspace is called to refresh its blocks.
Parameter |
|
---|---|
workspace |
The workspace to subscribe. Value must not be null. |
unsubscribe
unsubscribe(element)
Unsubscribe an element to changes to the selected theme.
Parameter |
|
---|---|
element |
Element The element to unsubscribe. |
unsubscribeWorkspace
unsubscribeWorkspace(workspace)
Unsubscribe a workspace to changes to the selected theme.
Parameter |
|
---|---|
workspace |
The workspace to unsubscribe. Value must not be null. |
Abstract type
Component
{element: non-null Element, propertyName:string}
A Blockly UI component type.