Comments (5)
Thanks for describing the fix! I'll re-open this as a reminder to add docs, or add WorkerGlobalScope
to eframe
from egui.
Interesting!
The fix could be for NeedRepaint::repaint_after
to try to get the current time and on failure set repaint_time
to -INF
to just force a repaint asap. ctx.request_repaint_after(…)
would not work properly from a web-worker though. Not sure how to handle that case.
from egui.
It's possible to get the time though, chrono::Local::now()
works from the web worker. But eframe is using the Performance api which isn't exposed by js-sys for workers apparently (though the object is useable from workers). Either we could write some kind of wrapper for that that calls the Performance api without using the window object, or when called from a web worker request_repaint could use the low resolution time.
from egui.
web-sys exposes the Performance API for workers as web_sys::WorkerGlobalScope::performance
. You just need to be using web-sys 0.3.65 or later and have the Performance
and WorkerGlobalScope
features enabled.
from egui.
web-sys exposes the Performance API for workers as
web_sys::WorkerGlobalScope::performance
. You just need to be using web-sys 0.3.65 or later and have thePerformance
andWorkerGlobalScope
features enabled.
Thanks, that was it! Performance
was already listed by eframe
but not WorkerGlobalScope
, adding it fixed the problem. I think mentioning that in the docs somewhere (for other people who'd like to use egui along with Web Workers) could be good
from egui.
Related Issues (20)
- [IME] Can't input CompositionEnd only characters because of checking ccursor.index and ime_cursor.index HOT 2
- Gif Support HOT 1
- Custom light & dark themes on system theme change HOT 1
- Add a User-Agent header to HTTP image loader HOT 5
- Dithering in Fragment Shader HOT 1
- moving the mouse outside of the window will still cause the window to update
- Mobile web text editing tracking issue
- `include_image!` macro should take in an `expr` not a `literal`
- Phantom key presses when focusing an egui/winit window HOT 3
- Configurable plot cursor "snap" radius HOT 1
- TableBuilder / available_width() HOT 1
- Smooth zooming
- High CPU usage when accesskit enabled HOT 11
- Crashing on startup HOT 4
- Zoom out the plot with right mouse drag
- Store a Ui/Frame-stack
- Sizing-pass flag
- Wayland dependencies are pulled in for eframe, even when `wayland` feature is disabled. HOT 1
- egui_plot legend: add shortcut to hide all series but this one
- Grid layout for windows
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from egui.