Yes, that looks fine to me. It's safe because jsiQueueEvents will add references to all the stuff it cares about, so even when unlocked it won't get freed.
In that case I'd consider using jsvUnLock3 though - it's stupid, but I changed all the multiple unlocks to calls to jsvUnLock2 and jsvUnLock3, and saved about 10kB of flash IIRC :)
Also there's jsvUnLockMany that you can use on arrays of JsVars
Espruino is a JavaScript interpreter for low-power Microcontrollers. This site is both a support community for Espruino and a place to share what you are working on.
Yes, that looks fine to me. It's safe because jsiQueueEvents will add references to all the stuff it cares about, so even when unlocked it won't get freed.
In that case I'd consider using
jsvUnLock3
though - it's stupid, but I changed all the multiple unlocks to calls to jsvUnLock2 and jsvUnLock3, and saved about 10kB of flash IIRC :)Also there's
jsvUnLockMany
that you can use on arrays of JsVars