Skip to content

bindProcs issue: CONSOLE JS ERROR ReferenceError: Can't find variable: api #20

Open
@yaroslav-gwit

Description

Hello again. Could you please help me out with this error message?
It shows up in the Nim console:

index.html#loaded:53:4: CONSOLE JS ERROR ReferenceError: Can't find variable: api

Code snippets I used:
app.nim

import webgui
import os
import strutils
import osproc

let app = newWebView(currentHtmlPath(), "Window Title", 650, 610)

app.bindProcs("api"):
  proc callback() = echo execCmd("echo 'Nim is awesome'")

app.run()
app.exit()

index.html button

<button onclick="api.callback()" type="button" class="btn btn-warning m-1" style="min-width: 170px;">Remind me later</button>

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions