Skip to content

Add option "buttonCallbacks" #9541

@TerrapinSoftware

Description

@TerrapinSoftware

Check for duplicates

  • I have searched for similar issues before opening a new one.

Problem

See also #1446. When you add a button to a category-less toolbox, you cannot register a button callback because the toolbox is created immediately when calling inject() to create the workspace.

Request

To fix this, I'd suggest adding an option "buttonCallbacks", which is an object with the key being the callbackKey and the value being the callback function. This way, button callbacks are always available when the toolbox is created.

Example

...
buttonCallbacks: { 
  mycallback: function(button) { ... }, 
  myothercallback: function(button) { ... }
}

Alternatives considered

Another useful option would be a callback or an event that is fired immediately after initializing the workspace so users have an option to add/modify the workspace.

Additional context

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    issue: feature requestDescribes a new feature and why it should be addedissue: triageIssues awaiting triage by a Blockly team member

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions