Comments (5)
update: this seems to be a more general problem with Promises. if you setTimeout, everything works normal. however, creating a loop such as
for(let i = 0; i < 5; i ++) {
console.log('waiting 1 second');
await new Promise(res => setTimeout(res, 1000));
}
causes the execution to only return to the resolution of the promise once ive moved to another virtual desktop. (3/4 finger scroll over to a fullscreen app, for example)
This leads me to believe that execution of promise then
callbacks is the culprit here.
from qode.
Update: After a lot of tinkering, I've isolated that the execution of promise.then(cb)
callbacks do eventually get called, but only when the window is updated. This is why when moving between screens, and its focus state changed, promises would resolve.
my current workaround to this (which is terrible for performance), is to have an infinite loop that calls win.update()
function updateLoop() {
win.update();
win.repaint();
setTimeout(updateLoop, 100);
}
updateLoop();
Edit: turns out one needs both a repaint, and an update call to fully allow Promises to resolve. updated workaround code.
from qode.
Yep this looks like a bug.
Can you see if an older version of qode works for you?
This looks like it might be an issue with recent node version upgrade.
from qode.
as i must import nodegui
to get the bug to happen, and im getting unrelated errors trying to use a version of qode
mismatched with the nodegui
version, Im testing each nodegui
version here. Each test creates 5 promises resolved after a setTimeout
of 0ms.
Each install i rm -rf
ed the node modules directory, to ensure cleanliness, and always used the version of qode store in node_modules/.bin
.
The setup seems to be extremely finicky, so I've also included my test file.
app.js
// swap out import / require for app.js / app.mjs testing
import '@nodegui/nodegui';
// require('@nodegui/nodegui');
function unoMomento() {
return new Promise(res => {
setTimeout(res, 0)
})
}
function doPromise() {
unoMomento().then(_ => {
console.log('resolved')
})
}
doPromise();
doPromise();
doPromise();
doPromise();
doPromise();
setTimeout(_ => {
console.log('done?')
}, 1000)
nodegui version |
Resolved Promises ESM | CJS |
---|---|---|
0.34.0 | 0 | 0 |
0.33.3 | 0 | |
0.33.0 | 0 | |
0.32.0 | 0 | |
0.31.0 | 0 | |
0.30.3 | 0 | |
0.30.0 | * | |
0.29.0 | * | |
0.28.1 | 0 | |
0.27.0 | 0 | |
0.26.0 | 0 | |
0.25.0 | 0 | 0 |
0.24.0 | 0 | 0 |
0.23.1 | 0 | 0 |
0.23.0 | 0 | 0 |
0.22.0 | 0 | 0 |
0.21.0 | 0 | 0 |
0.15.5 | 0 | 0 |
0.15.4 | 0 | 0 |
0.15.3 | 0 | 0 |
0.15.2 | ** | ** |
0.15.1 | ** | ** |
0.15.0-alpha-4 | ** | ** |
0.15.0-alpha | ** | ** |
0.13.4 | - | 5 |
0.12.1 | - | 5 |
0.6.5 | - | 5 |
* came back with an error about not being able to find the binding. '../../../build/Release/nodegui_core.node'
** came back with an error about my QT setup
Blanks are untested; Dashes are ERR_REQUIRE_ESM
(assuming an old enough version of node that import syntax wasn't yet mature)
Hope this info is helpful!
from qode.
This is issue is solved in master branch of qode.
But since I am having some issues with windows build I haven't yet made a release.
In the meantime can you look if this binary solves the issue for you
from qode.
Related Issues (20)
- support for ia32 or arm64 on windows HOT 5
- Support global or root-user installations on Linux HOT 5
- Micro tasks being run manually HOT 2
- Question: What's wrong with my env? HOT 2
- Add node version correspondance HOT 1
- Errors while building on Windows 10 HOT 1
- qode.exe run error in chinese path? HOT 2
- qode.exe can't be renamed after packaging? HOT 3
- Cache downloaded resources HOT 1
- armv7l release HOT 2
- qode.exe runs only when run from the deploy/win32/build/AppName folder HOT 3
- Starting qode when user logs into windows? HOT 1
- Can only run qode via npm script?
- npm install fails with 'https://github.com/nodegui/qode/releases/download/v2.1.0/qode-darwin-arm64-v2.1.0.tar.gz. Not Found' HOT 4
- Documentation for injecting event loop HOT 5
- npm install fails HOT 1
- Win32 support HOT 4
- windows10 build failed HOT 2
- Proposal: define libraries to include in qode.json HOT 6
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 qode.