Files
blockly/core/events/events_ui_base.ts
Beka Westberg f678531389 chore: remove AnyDuringMigration from events (#6382)
* chore: remove AnyDuringMigration from events

* chore: format

* chore: lint

* chore: fix tests

* fix: correct types for JSON properties

* chore: fix tests

* refactor: replace exclamation markers with errors

* chore: fix build and tests

* chore: set event types as members, rather than in constructor

* chore: update comment

* chore: export new types

* chore: format

* chore: remove unnecessary override

* chore: change how we're overriding isBlank

* chore: remove unnecessary ?

* chore: remove non-null assertion in block move event

* chore: format

* chore: revert changes to isNull

* chore: format
2022-09-27 15:08:05 -07:00

52 lines
1.3 KiB
TypeScript

/**
* @license
* Copyright 2020 Google LLC
* SPDX-License-Identifier: Apache-2.0
*/
/**
* Base class for events fired as a result of UI actions in
* Blockly's editor.
*
* @class
*/
import * as goog from '../../closure/goog/goog.js';
goog.declareModuleId('Blockly.Events.UiBase');
import {Abstract as AbstractEvent} from './events_abstract.js';
/**
* Base 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.
*
* @alias Blockly.Events.UiBase
*/
export class UiBase extends AbstractEvent {
override isBlank = true;
override workspaceId: string;
// UI events do not undo or redo.
override recordUndo = false;
/** Whether or not the event is a UI event. */
override isUiEvent = true;
/**
* @param opt_workspaceId The workspace identifier for this event.
* Undefined for a blank event.
*/
constructor(opt_workspaceId?: string) {
super();
/** Whether or not the event is blank (to be populated by fromJson). */
this.isBlank = typeof opt_workspaceId === 'undefined';
/** The workspace identifier for this event. */
this.workspaceId = opt_workspaceId ? opt_workspaceId : '';
}
}