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

async support for js_api ? #867

Closed
manatlan opened this issue Mar 5, 2022 · 4 comments
Closed

async support for js_api ? #867

manatlan opened this issue Mar 5, 2022 · 4 comments
Labels

Comments

@manatlan
Copy link

manatlan commented Mar 5, 2022

Specification

  • pywebview version: latest
  • operating system: ubuntu latest
  • web renderer: html+js

Description

Seems that "js_api" support only sync method.
Do you plan to support async method in your loop ?

I would like to do something like that :

        class Api:
            async def interact(self):
                return await mymethod()

        window = webview.create_window("title", html=html, js_api=Api())
@r0x0r
Copy link
Owner

r0x0r commented Mar 5, 2022

There has been an async discussion here #801

Async support could be added, but to be brutally honest my async game is not very strong.
I am open to suggestions how this should be implemented.

@manatlan
Copy link
Author

manatlan commented Mar 12, 2022

In fact, I'm working on HTAG
( Which is a gui toolkit for building gui toolkits )

Here is a demo, with pywebview backend

$ pip3 install htag pywebview
$ wget https://raw.githubusercontent.com/manatlan/htag/main/examples/demo.py
$ python3 demo.py

It works well here, because everything is sync ...
But when "async" call, it can't work with the pywebview backend ;-(

I will have a look in the pywebview code, to try to make it async compliant in a main loop

EDIT : renaming all project wheel, from thag to htag

@github-actions
Copy link

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@github-actions github-actions bot added the stale label Apr 14, 2022
@github-actions
Copy link

The message to post on the issue when closing it. If none provided, will not comment when closing an issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants