Comments (4)
But, what you propose sounds like indexing of blocks by a tag, so why not just use an object of key -> array of blocks.
An object like {key, [blocks]} is indeed the basic idea. The proposal just adds some utility functions to make things easier.
Using utility functions allows us to save information about where the block is stored to the block. We need to know where the block is stored so that when we dispose of the block we can remove it from all collections. If it gets left in a collection we'll get detached nodes :/
So addBlockToCollection
, removeBlockFromCollection
, and removeBlockFromAllCollections
are just to make it so you don't have to think as much when you dispose of your block.
from blockly-samples.
@BeksOmega How do you feel about moving this to samples?
Rachel and I discussed and we don't think this belongs in core-
- It's doable as a plugin right now using events
- The main use case you laid out, procedure blocks, are going to have their own management system thanks to the shared procedures API / procedure maps
from blockly-samples.
I would have use for such collections and see workspace analysis performance as the main benefit. But I'm not sure if it should be part of Blockly or be left to projects to add if needed. Updating collections could be handled outside Blockly by a workspace event listener.
from blockly-samples.
So, wrt to solution 1 above, if you are just iterating through plain old JS objects (ie. not DOM) then it should be perfectly fine performance wise, even when the block count reaches 1k or more. Performance problems usually only surface when DOM (or other non-JS API) interactions are involved.
But, what you propose sounds like indexing of blocks by a tag, so why not just use an object of key -> array of blocks.
from blockly-samples.
Related Issues (20)
- Update field colour readme to explain that the developer must load a message file/set a locale HOT 2
- Consider excluding test-only changes from lerna release
- Update multiline text readme to include the information currently on devsite HOT 1
- Merge `blocks_for_fields` into `master` HOT 1
- Error: Property 'decoratePreviewerWithDynamicConnections' does not exist on type 'typeof import ("("/home/user/Documents/blockly/node_modules/@blockly/block-dynamic-connection/dist/index")'. HOT 1
- Save/load/delete multiple blocks
- Block factory: add generator stubs
- Block factory: adding code headers
- Block factory: import plugin fields HOT 1
- Block factory: backwards compatibility
- Block factory: redirect at top of old block factory
- Block factory: redirect back to old block factory
- eslint config disallows CONSTANT_CASE HOT 1
- Block factory: add shadow blocks to inputs HOT 1
- Resetting the workspace state when entering data in num and funcs HOT 5
- Make it so that the backpack is compatible with other types besides blocks HOT 1
- Update context menu codelab (scope + events)
- Content-highlight doesn't update for workspace comment move events
- typed-variable-modal plugin is not on plugins index page HOT 7
- Toolbox section of demos page is broken
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from blockly-samples.