parro-it / libui-node

Node bindings for libui, an awesome native UI library for Unix, OSX and Windows
MIT License
1.88k stars 85 forks source link

Implement onShouldQuit with the same semnatic as libui (return true from the cb will stop the loop) #98

Open mischnic opened 6 years ago

mischnic commented 6 years ago

Should return the cb's return value, currently: https://github.com/parro-it/libui-node/blob/df1eefdd71d41356e9eaefc1d312d32c3739c861/src/Ui.cc#L6-L10

How it's used by libui (pseudocode):

if (uiShouldQuitCb())
    uiQuit();
parro-it commented 6 years ago

We cannot let libui call uiQuit alone, because we have to call our stopLoop method instead (it call uiQuit after it had cleaned up other things).

So we can implement the same semantic, but always return 0. Also, we'll have to implement this on JS side, because we also have to unpatch global timers functions.