parro-it/libui-node

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

mischnic opened this issue · 1 comments

Should return the cb's return value, currently:

libui-node/src/Ui.cc

Lines 6 to 10 in df1eefd

static int onShouldQuit_cb(void *data) {
nbind::cbFunction *cb = (nbind::cbFunction *) data;
(*cb)();
return 0;
}

How it's used by libui (pseudocode):

if (uiShouldQuitCb())
	uiQuit();

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.