Stay organized with collections
Save and categorize content based on your preferences.
blockly > Events > Abstract
Events.Abstract class
Abstract class for an event.
Signature:
export declare abstract class Abstract
Constructors
Constructor |
Modifiers |
Description |
(constructor)() |
|
Constructs a new instance of the Abstract class |
Properties
Property |
Modifiers |
Type |
Description |
group |
|
string |
An ID for the group of events this block is associated with. Groups define events that should be treated as an single action from the user's perspective, and should be undone together. |
isBlank |
abstract |
boolean |
Whether or not the event was constructed without necessary parameters (to be populated by fromJson). |
isUiEvent |
|
boolean |
Whether or not the event is a UI event. |
recordUndo |
|
boolean |
Whether this event is undoable or not. |
type |
|
string |
Type of this event. |
workspaceId? |
|
string |
(Optional) The workspace identifier for this event. |
Methods
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2025-05-16 UTC.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-05-16 UTC."],[[["\u003cp\u003e\u003ccode\u003eEvents.Abstract\u003c/code\u003e is a base class for all Blockly events, defining common properties and methods.\u003c/p\u003e\n"],["\u003cp\u003eIt provides properties like \u003ccode\u003etype\u003c/code\u003e, \u003ccode\u003egroup\u003c/code\u003e, \u003ccode\u003erecordUndo\u003c/code\u003e, and \u003ccode\u003eisUiEvent\u003c/code\u003e to describe event characteristics.\u003c/p\u003e\n"],["\u003cp\u003eEvents can be serialized to JSON using \u003ccode\u003etoJson()\u003c/code\u003e and executed with \u003ccode\u003erun()\u003c/code\u003e.\u003c/p\u003e\n"],["\u003cp\u003eSubclasses implement specific event logic and data.\u003c/p\u003e\n"],["\u003cp\u003e\u003ccode\u003eisBlank\u003c/code\u003e property indicates if the event was created without full information, potentially to be filled by \u003ccode\u003efromJson()\u003c/code\u003e.\u003c/p\u003e\n"]]],["The `Events.Abstract` class serves as a base for event handling. Key properties include a `group` ID for related events, `isBlank` indicating incomplete construction, `isUiEvent` denoting UI-related events, and `recordUndo` determining if the event is undoable. Each event has a `type` and optionally a `workspaceId`. Core methods include `isNull()` to check for state change, `run()` to execute the event, and `toJson()` for JSON encoding.\n"],null,["[blockly](./blockly.md) \\\u003e [Events](./blockly.events_namespace.md) \\\u003e [Abstract](./blockly.events_namespace.abstract_class.md)\n\nEvents.Abstract class\n---------------------\n\nAbstract class for an event.\n\n**Signature:** \n\n export declare abstract class Abstract \n\nConstructors\n------------\n\n| Constructor | Modifiers | Description |\n|---------------------------------------------------------------------------------------------|-----------|---------------------------------------------------|\n| [(constructor)()](./blockly.events_namespace.abstract_class._constructor__1_constructor.md) | | Constructs a new instance of the `Abstract` class |\n\nProperties\n----------\n\n| Property | Modifiers | Type | Description |\n|-----------------------------------------------------------------------------------|------------|---------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| [group](./blockly.events_namespace.abstract_class.group_property.md) | | string | An ID for the group of events this block is associated with. Groups define events that should be treated as an single action from the user's perspective, and should be undone together. |\n| [isBlank](./blockly.events_namespace.abstract_class.isblank_property.md) | `abstract` | boolean | Whether or not the event was constructed without necessary parameters (to be populated by fromJson). |\n| [isUiEvent](./blockly.events_namespace.abstract_class.isuievent_property.md) | | boolean | Whether or not the event is a UI event. |\n| [recordUndo](./blockly.events_namespace.abstract_class.recordundo_property.md) | | boolean | Whether this event is undoable or not. |\n| [type](./blockly.events_namespace.abstract_class.type_property.md) | | string | Type of this event. |\n| [workspaceId?](./blockly.events_namespace.abstract_class.workspaceid_property.md) | | string | *(Optional)* The workspace identifier for this event. |\n\nMethods\n-------\n\n| Method | Modifiers | Description |\n|--------------------------------------------------------------------------------------------------|-----------|---------------------------------------------|\n| [getEventWorkspace_()](./blockly.events_namespace.abstract_class.geteventworkspace__1_method.md) | | Get workspace the event belongs to. |\n| [isNull()](./blockly.events_namespace.abstract_class.isnull_1_method.md) | | Does this event record any change of state? |\n| [run(_forward)](./blockly.events_namespace.abstract_class.run_1_method.md) | | Run an event. |\n| [toJson()](./blockly.events_namespace.abstract_class.tojson_1_method.md) | | Encode the event as JSON. |"]]