Constructor

ThemeManager

new ThemeManager(theme)

Class for storing and updating a workspace's theme and UI components.

Parameter

theme

Blockly.Theme

The workspace theme.

Value must not be null.

Methods

dispose

package

dispose()

Dispose of this theme manager.

getTheme

package

getTheme() returns Blockly.Theme

Get the workspace theme.

Returns

non-null Blockly.Theme The workspace theme.

setTheme

package

setTheme(theme)

Set the workspace theme, and refresh the workspace and all components.

Parameter

theme

Blockly.Theme

The workspace theme.

Value must not be null.

subscribe

package

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

package

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

Blockly.Workspace

The workspace to subscribe.

Value must not be null.

unsubscribe

package

unsubscribe(element)

Unsubscribe an element to changes to the selected theme.

Parameter

element

Element

The element to unsubscribe.

unsubscribeWorkspace

package

unsubscribeWorkspace(workspace)

Unsubscribe a workspace to changes to the selected theme.

Parameter

workspace

Blockly.Workspace

The workspace to unsubscribe.

Value must not be null.

Abstract type

Component

static

{element: non-null Element, propertyName:string}

A Blockly UI component type.