mirror of
https://github.com/google/blockly.git
synced 2026-01-08 17:40:09 +01:00
fix: make eventUtils throw if event type not registered (#6381)
* chore: update lint rules * fix: have eventUtils.get throw if event isn't found * chore: remove nonnull assertion from eventUtils.get and format
This commit is contained in:
committed by
GitHub
parent
980fe138e7
commit
60bc01acc8
@@ -503,8 +503,7 @@ export function domToWorkspace(xml: Element, workspace: Workspace): string[] {
|
||||
if ((workspace as WorkspaceSvg).setResizesEnabled) {
|
||||
(workspace as WorkspaceSvg).setResizesEnabled(true);
|
||||
}
|
||||
eventUtils.fire(new (eventUtils.get(eventUtils.FINISHED_LOADING))!
|
||||
(workspace));
|
||||
eventUtils.fire(new (eventUtils.get(eventUtils.FINISHED_LOADING))(workspace));
|
||||
return newBlockIds;
|
||||
}
|
||||
|
||||
@@ -618,12 +617,12 @@ export function domToBlock(xmlBlock: Element, workspace: Workspace): Block {
|
||||
// Fire a VarCreate event for each (if any) new variable created.
|
||||
for (let i = 0; i < newVariables.length; i++) {
|
||||
const thisVariable = newVariables[i];
|
||||
eventUtils.fire(new (eventUtils.get(eventUtils.VAR_CREATE))!
|
||||
(thisVariable));
|
||||
eventUtils.fire(
|
||||
new (eventUtils.get(eventUtils.VAR_CREATE))(thisVariable));
|
||||
}
|
||||
// Block events come after var events, in case they refer to newly created
|
||||
// variables.
|
||||
eventUtils.fire(new (eventUtils.get(eventUtils.CREATE))!(topBlock));
|
||||
eventUtils.fire(new (eventUtils.get(eventUtils.CREATE))(topBlock));
|
||||
}
|
||||
return topBlock;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user