call receiveNumber in onDataReceived to flush queue if needed (startup race)
fixed simulator issue when event onDataReceived gets raised
This commit is contained in:
16
libs/microbit-radio/shims.d.ts
vendored
16
libs/microbit-radio/shims.d.ts
vendored
@@ -41,14 +41,6 @@ declare namespace radio {
|
||||
//% blockId=radio_write_value_serial block="radio write value to serial" shim=radio::writeValueToSerial
|
||||
function writeValueToSerial(): void;
|
||||
|
||||
/**
|
||||
* Registers code to run when a packet is received over radio.
|
||||
*/
|
||||
//% help=radio/on-data-received
|
||||
//% weight=50
|
||||
//% blockId=radio_datagram_received_event block="radio on data received" blockGap=8 shim=radio::onDataReceived
|
||||
function onDataReceived(body: () => void): void;
|
||||
|
||||
/**
|
||||
* Reads a number at a given index, between ``0`` and ``3``, from the packet received by ``receive number``. Not supported in simulator.
|
||||
* @param index index of the number to read from 0 to 3. 1 eg
|
||||
@@ -66,6 +58,14 @@ declare namespace radio {
|
||||
//% blockId=radio_datagram_receive block="radio receive number" blockGap=8 shim=radio::receiveNumber
|
||||
function receiveNumber(): number;
|
||||
|
||||
/**
|
||||
* Registers code to run when a packet is received over radio.
|
||||
*/
|
||||
//% help=radio/on-data-received
|
||||
//% weight=50
|
||||
//% blockId=radio_datagram_received_event block="radio on data received" blockGap=8 shim=radio::onDataReceived
|
||||
function onDataReceived(body: () => void): void;
|
||||
|
||||
/**
|
||||
* Reads the next packet as a string and returns it.
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user