pass closure from js to avoid global

This commit is contained in:
Eric House 2021-02-10 14:19:16 -08:00
parent 880bff747d
commit b368d0b801
2 changed files with 3 additions and 3 deletions

View file

@ -517,10 +517,10 @@ looper( void* closure )
}
void
button( const char* msg )
button( void* closure, const char* msg )
{
XP_Bool draw = XP_FALSE;
Globals* globals = sGlobals;
Globals* globals = (Globals*)closure;
BoardCtxt* board = globals->game.board;
XP_Bool redo;

View file

@ -195,7 +195,7 @@
}
function callButton(name) {
Module.ccall('button', null, ['string'], [name]);
Module.ccall('button', null, ['number', 'string'], [state.closure, name]);
}
function onHaveDevID(closure, devid) {