Skip to content

Add Helper for Checking if Workspace Code/XML Should be Regenerated #2711

@BeksOmega

Description

@BeksOmega

Is your feature request related to a problem? Please describe.

Insertion markers seem to be making it tricky to know when to generate XML/Code from a workspace.

#2322
#2646

Describe the solution you'd like

There should be a function inside Blockly.Events that you can call to tell if an event is a valid "changing" event. E.g. Blockly.Events.isWorkspaceChangeEvent(event). (Probably needs a better name)

Developers can then include that check inside their realtime generation listener. And only generate the code/XML if it returns true.

This function could simply perform a Workspace.isDragging check, as has been recommended previously. Or it could do more advanced event filtering, e.g. filtering out all UI events.

The advantage of a system like this is that it can be updated as Blockly evolves, without requiring developers to add code on their end.

Describe alternatives you've considered

The realtime code generation documentation could be updated to recommend an isDragging check, and in the future be updated every time something effects code generation. But this would require developers to A) notice every change made to the docs and B) make changes in their own code for every change. I.E. this solution doesn't scale with time.

Additional context

I would be willing to impliment this & add tests (not sure what those tests would be yet though).

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions