python-eel / Eel

A little Python library for making simple Electron-like HTML/JS GUI apps
MIT License
6.44k stars 587 forks source link

Extract event callback for DOMContentLoaded to coordinate working with ant design pro #445

Open lincoln310 opened 3 years ago

lincoln310 commented 3 years ago

Eel version eel 0.1.1

Describe the bug With ant design pro (short for antdpro), eel.js should be used in document.ejs, and antdpro will compile this ejs and all the tsx. The error comes here: when debugging, tsx will load after ejs. So when eel.js is downloaded in ejs, and the eel._init() involked,

To Reproduce Steps to reproduce the behavior:

  1. use ant design pro to generate a new app
  2. from example/07-CreateReactApp copy eel-CRA.py to app's root path
  3. copy example/07.../src/App.* to app's src/pages/
  4. add to document.ejs

Expected behavior it should work with antdpro

Desktop (please complete the following information):

Additional context I changed this to make it work: 1 Extract the callback for event DOMContentLoaded to a functioin with name afterLoad() 2 call this from App.tsx after set_host

Or replace the eel._host in python, and don't use this:

let websocket_addr = (eel._host + '/eel').replace('http', 'ws');
            websocket_addr += ('?page=' + page);