Skip to content

Extensions Take 2 #702

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 30 commits into from

Conversation

TheBrokenRail
Copy link
Contributor

@TheBrokenRail TheBrokenRail commented Oct 21, 2016

Now Actually Works!

I've tested block shapes and the toolbox both seem to work well.

Changes Since Last Time

Lots of bugs fixed, now imports in objects not JSON. Has a import function that takes JavaScript code. JavaScript code would be used to create and push the object. Also, because of lookup function you can store data on the block object such as a function to run in a implementation.

Loader Script Example

Blockly.Extensions.loadExtension("Blockly.Extensions.EXTENSIONS.push([{"type":"Block Type","spec":"Demo","id":"Block Spec","run":"Function Object"}]);");

JS Object Example

[
    {
        "type":"Block Type",
        "spec":"Demo",
        "id":"Block Spec",
        "run":"Function Object"
    }
]

Block Types

  • block
  • reporter
  • boolean
  • hat
  • cap

Defaults and Changes

  • Shapes are now mutations
  • Now has a default shape if invalid: "block"
  • Colour Inputs Work Now

Why JavaScript Code

You need something to create the objects and you might want to run other code.

Example Implementation For Scratch-VM

var block = Blockly.Extentions.lookupBlock(args.mutation.id);
block.run(args, util);

Input Types

  • n (Number)
  • s (String)
  • c (Colour)
  • b (Boolean)
  • i (Substack)

@towerofnix
Copy link
Contributor

Blockly.Extensions.loadExtension(
  "Blockly.Extensions.EXTENSIONS.push([{"type":"Block Type","spec":"Demo","id":"Block Spec","run":"Function Object"}]);"
);

First - that's an invalid string. Second - why not just do Blockly.Extensions.EXTENSIONS.push?

@thisandagain
Copy link
Contributor

Thanks @TheBrokenRail but as per my comment on your last PR we are not interested in adding features that will likely be fundamentally redesigned such as Extensions at this time.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants