microsoft / pxt-microbit

A Blocks / JavaScript code editor for the micro:bit built on Microsoft MakeCode
https://makecode.microbit.org
Other
699 stars 581 forks source link

The TypeScript `control.onEvent()` `flags` argument is not passed to the DAL/CODAL event listener #5709

Open microbit-carlos opened 2 weeks ago

microbit-carlos commented 2 weeks ago

The control.onEvent() C++ function checks if any flag is provided, and if not it set the EventFlags::QueueIfBusy by default: https://github.com/microsoft/pxt-microbit/blob/5b0d30fae81e856f98a17b7f1db60843bd438dcd/libs/core/control.cpp#L304-L307

However, the registerWithDal() function then ignores the flags argument: https://github.com/microsoft/pxt-microbit/blob/5b0d30fae81e856f98a17b7f1db60843bd438dcd/libs/core/codal.cpp#L99-L104

So, it ultimately depends on the CODAL default beings set to MESSAGE_BUS_LISTENER_QUEUE_IF_BUSY via the EVENT_LISTENER_DEFAULT_FLAGS config: