Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

183
Vistas
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
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda