Constructor

Ui

new Ui(block, element, oldValue, newValue)

Class for a UI event. UI events are events that don't need to be sent over the wire for multi-user editing to work (e.g. scrolling the workspace, zooming, opening toolbox categories). UI events do not undo or redo.

Parameter

block

Blockly.Block

The affected block.

element

string

One of 'selected', 'comment', 'mutator', etc.

oldValue

any type

Previous value of element.

newValue

any type

New value of element.

Extends
Blockly.Events.Abstract

Properties

group

unknown

The event group id for the group this event belongs to. Groups define events that should be treated as an single action from the user's perspective, and should be undone together.

Inherited from
Blockly.Events.Abstract#group

recordUndo

unknown

Sets whether the event should be added to the undo stack.

Inherited from
Blockly.Events.Abstract#recordUndo

type

string

Type of this event.

workspaceId

unknown

The workspace identifier for this event.

Inherited from
Blockly.Events.Abstract#workspaceId

Methods

fromJson

fromJson(json)

Decode the JSON event.

Parameter

json

Object

JSON representation.

Value must not be null.

getEventWorkspace_

protected

getEventWorkspace_() returns Blockly.Workspace

Get workspace the event belongs to.

Inherited from
Blockly.Events.Abstract#getEventWorkspace_
Throws

if workspace is null.

Returns

The workspace the event belongs to.

isNull

isNull() returns boolean

Does this event record any change of state?

Inherited from
Blockly.Events.Abstract#isNull
Returns

True if null, false if something changed.

run

run(_forward)

Run an event.

Parameter

_forward

True if run forward, false if run backward (undo).

Inherited from
Blockly.Events.Abstract#run

toJson

toJson() returns Object

Encode the event as JSON.

Returns

non-null Object JSON representation.
{"cc_re__cc_re__cc_by_3_0": ["              <dt>Returns</dt>\n                <dd>\n                  <p><code>non-null Object</code>&nbsp;JSON representation.</p>\n                </dd>\n              </dl>\n            </section>\n          </section>\n        </div>\n      </div>\n      <nav id=\"jsdoc-toc-nav\" role=\"navigation\"></nav>\n    </div>\n  </div>\n\n  </div>\n  \n\n  \n        \n  \n\n\n\n\n\n\n\n        \n<div class=\"devsite-content-footer nocontent\">\n  \n  \n    <p>Except as otherwise noted, the content of this page is licensed under the <a href=\"https://creativecommons.org/licenses/by/3.0/\">Creative Commons Attribution 3.0 License</a>, and code samples are licensed under the <a href=\"https://www.apache.org/licenses/LICENSE-2.0\">Apache 2.0 License</a>. For details, see our <a href=\"https://developers.google.cn/terms/site-policies\">Site Policies</a>. Java is a registered trademark of Oracle and/or its affiliates.</p>\n  \n\n  \n    \n    <p class=\"devsite-content-footer-date\" itemprop=\"datePublished\"\n       content=\"2018-07-03T18:44:54.550350\">\n      \n      \u4e0a\u6b21\u66f4\u65b0\u65e5\u671f\uff1a\u4e03\u6708 3, "]}