-
-
Notifications
You must be signed in to change notification settings - Fork 594
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add support for reloading the Bottle server during development. Eel on the JS side will now try to automatically reconnect to the Python/Bottle server when the websocket dies. This allows us to let the Bottle server die and restart to pull in new changes. An explicit port must be set when we want to use the reloading server to make sure that it restarts on the same port, as that is the port that the JS side will be trying to connect to.
- Loading branch information
1 parent
e6db3f0
commit ee74005
Showing
9 changed files
with
167 additions
and
40 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
import eel | ||
|
||
eel.init("web") | ||
|
||
|
||
@eel.expose | ||
def updating_message(): | ||
return "Change this message in `reloader.py` and see it available in the browser after a few seconds/clicks." | ||
|
||
|
||
eel.start("reloader.html", size=(320, 120), reload_python_on_change=True) |
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
<!DOCTYPE html> | ||
<html> | ||
<head> | ||
<title>Reloader Demo</title> | ||
<script type='text/javascript' src='/eel.js'></script> | ||
<script type='text/javascript'> | ||
|
||
async function updating_message() { | ||
let file_div = document.getElementById('updating-message'); | ||
|
||
// Call into Python so we can access the file system | ||
let message = await eel.updating_message()(); | ||
file_div.innerHTML = message; | ||
} | ||
|
||
</script> | ||
</head> | ||
|
||
<body> | ||
<form onsubmit="updating_message(); return false;" > | ||
<button type="submit">Run Python code</button> | ||
</form> | ||
<div id='updating-message'>---</div> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters