Custom handler key
This commit is contained in:
parent
186d7348e3
commit
03f9830ca9
@ -49,7 +49,7 @@ namespace radio {
|
||||
* Registers code to run when the radio receives a packet. Also takes the
|
||||
* received packet from the radio queue.
|
||||
*/
|
||||
//% help=radio/on-data-packet-received deprecated=true
|
||||
//% help=radio/on-data-packet-received blockHandlerKey="radioreceived" deprecated=true
|
||||
//% mutate=objectdestructuring
|
||||
//% mutateText=Packet
|
||||
//% mutateDefaults="receivedNumber;receivedString:name,receivedNumber:value;receivedString"
|
||||
@ -72,7 +72,7 @@ namespace radio {
|
||||
/**
|
||||
* Registers code to run when the radio receives a number.
|
||||
*/
|
||||
//% help=radio/on-radio-received-number
|
||||
//% help=radio/on-radio-received-number blockHandlerKey="radioreceived"
|
||||
//% blockId=radio_on_number block="on radio received" blockGap=8
|
||||
export function onReceivedNumber(cb: (receivedNumber: number) => void) {
|
||||
onDataReceived(() => {
|
||||
@ -90,7 +90,7 @@ namespace radio {
|
||||
/**
|
||||
* Registers code to run when the radio receives a key value pair.
|
||||
*/
|
||||
//% help=radio/on-radio-received-value
|
||||
//% help=radio/on-radio-received-value blockHandlerKey="radioreceived"
|
||||
//% blockId=radio_on_value block="on radio received" blockGap=8
|
||||
export function onReceivedValue(cb: (name: string, value: number) => void) {
|
||||
onDataReceived(() => {
|
||||
@ -109,7 +109,7 @@ namespace radio {
|
||||
/**
|
||||
* Registers code to run when the radio receives a string.
|
||||
*/
|
||||
//% help=radio/on-radio-received-string
|
||||
//% help=radio/on-radio-received-string blockHandlerKey="radioreceived"
|
||||
//% blockId=radio_on_string block="on radio received" blockGap=8
|
||||
export function onReceivedString(cb: (receivedString: string) => void) {
|
||||
onDataReceived(() => {
|
||||
@ -127,7 +127,7 @@ namespace radio {
|
||||
/**
|
||||
* Registers code to run when the radio receives a buffer.
|
||||
*/
|
||||
//% help=radio/on-radio-received-buffer blockHidden=1
|
||||
//% help=radio/on-radio-received-buffer blockHandlerKey="radioreceived" blockHidden=1
|
||||
//% blockId=radio_on_buffer block="on radio received" blockGap=8
|
||||
export function onReceivedBuffer(cb: (buffer: Buffer) => void) {
|
||||
onDataReceived(() => {
|
||||
|
Loading…
Reference in New Issue
Block a user