Skip to content
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

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

Open
yaroslav-gwit opened this issue Dec 16, 2022 · 3 comments
Labels
bug Something isn't working

Comments

@yaroslav-gwit
Copy link
Contributor

yaroslav-gwit commented Dec 16, 2022

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>
@juancarlospaco
Copy link
Owner

OS ?, Nim version ?

Please run the code, open the inspector,
and in JavaScript run window.external and send screenshot, if possible showing the autocomplete,
I need to know if you have window.external.* defined in JS in the window.

@juancarlospaco juancarlospaco added the bug Something isn't working label Dec 16, 2022
@yaroslav-gwit
Copy link
Contributor Author

Version: Nim Compiler Version 1.6.8 [Linux: amd64]
OS: PopOS 22.04

window.external is undefined:

> window.external
< undefined

@juancarlospaco
Copy link
Owner

So looks like it is in fact broken, but it is not my code,
it seems something upstream has broken compatibilities, that sux.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants