Skip to content

Generate main.blocks from main.ts after postMessage request #6660

@ssande-fwd

Description

@ssande-fwd

Is your feature request related to a problem? Please describe.
I've been experimenting with MakeCode Embed and I want to pass JavaScript for a MakeCode program into the iframe and have that JavaScript be used to generate the blocks for the project. I have only had success passing in a fully-formed MakeCodeProject object. If the XML is missing or empty then I either get an empty project or one time I got a project with the right JavaScript but no blocks view.

Describe the solution you'd like
I want to be able to send in JavaScript (main.ts) and pxt.json for a MakeCode project via a postMessage to a MakeCode iframe. I want MakeCode to then generate main.blocks based on the JavaScript provided.

Describe alternatives you've considered
I thought about generating the XML outside of MakeCode, so that I can pass in a fully-formed MakeCodeProject object, but that seems like a burdensome duplication of functionality. You can do what I'm fundamentally trying to do by simply pasting JavaScript into the editor and navigating back to blocks view. I just want to be able to trigger it in this alternate scenario.

Additional context
This is related to Forward Education product development efforts.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions