Move bind/unbind events functions to new file, with example usage. #4642
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
The basics
The details
Resolves
Resolves some dependency issues.
Proposed Changes
Moves three functions and one typedef onto a newly created namespace:
Blockly.bindEvent_->Blockly.browserEvents.bindBlockly.unbindEvent_->Blockly.browserEvents.unbindBlockly.bindEventWithChecks_->Blockly.browserEvents.conditionalBindBlockly.EventData->Blockly.browserEvents.DataFor backwards compatibility, I left aliases in blockly.js for these three functions. I plan to move all internal uses to the fully qualified name.
Behavior Change?
No change in behaviour
Reason for Changes
We have circular dependecies because blockly.js requires most parts of blockly (workspaces, etc) but defines key utility functions that are used throughout the codebase.
The functions are used all over the place and only require one thing (
Blockly.Touch). Moving the functions to their own namespace allows users to require them directly, rather than requiring the whole of Blockly.Documentation
Additional Information
This is a sample to show what the change will look like. I'd like to nail down names for the namespace and function before I change all of the uses.