Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

178
Views
Can't call any Blockly methods in index.html even tho it works in other .js-files and a workspace is shown

I'm trying to create a tool where you can create HTML-pages using Blockly-blocks. I already have a page that shows my workspace and my self-created block. Now I want to write a script that gets the code from the workspace. Normally there is a workspaceToCode-method in the Blockly-Library. Unfortunately I can't access any Blockly-methods or really anything Blockly-related in my index.html.

I've looked up similar projects and can't seem to find any differences. I'm loading "blockly_compressed.js", "blocks_compressed.js" and "javascript_compressed.js". And because it shows me a workspace with "functioning" blocks I'm pretty sure that the paths are correct.

See below what I tried and thanks in advance for your help:

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <link rel="stylesheet" href="styles.css">
    <style>
        ...
    </style>

    <script src="node_modules/blockly/blockly_compressed.js"></script>
    <script src="node_modules/blockly/blocks_compressed.js"></script>
    <script src="node_modules/blockly/msg/en.js"></script>
    <script src="node_modules/blockly/javascript_compressed.js"></script>

</head>

<body>

...

<script src="html_blocks.js"></script>
<script src="html_generator.js"></script>
<script src="main.js"></script>


<script>
    function update(event) {
        var code = HtmlGenerator.workspaceToCode(workspace);
        document.getElementById('HTMLCodeDiv').innerText = code;
    }
    workspace.addChangeListener(update);
</script>

</body>
</html>

The error it is giving is "unresolved function or method" for the workspaceToCode-method as well as the addChangeListener-method

about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!