Add auto toString for various APIs (#1033)

This commit is contained in:
Guillaume Jenkins 2018-08-02 16:30:02 -04:00 committed by GitHub
parent 27024baa51
commit 2700a77cae
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 15 additions and 8 deletions

View File

@ -33,6 +33,7 @@ namespace basic {
//% async
//% blockId=device_print_message
//% parts="ledmatrix"
//% text.shadowOptions.toString=true
void showString(String text, int interval = 150) {
if (interval <= 0)
interval = 1;

View File

@ -103,6 +103,7 @@ namespace serial {
//% help=serial/write-string
//% weight=87 blockGap=8
//% blockId=serial_writestring block="serial|write string %text"
//% text.shadowOptions.toString=true
void writeString(String text) {
if (!text) return;

View File

@ -11,6 +11,7 @@ namespace serial {
//% weight=90
//% help=serial/write-line blockGap=8
//% blockId=serial_writeline block="serial|write line %text"
//% text.shadowOptions.toString=true
export function writeLine(text: string): void {
if (!text) text = "";
// pad data to the 32 byte boundary

View File

@ -153,7 +153,8 @@ declare namespace basic {
//% block="show|string %text"
//% async
//% blockId=device_print_message
//% parts="ledmatrix" interval.defl=150 shim=basic::showString
//% parts="ledmatrix"
//% text.shadowOptions.toString=true interval.defl=150 shim=basic::showString
function showString(text: string, interval?: int32): void;
/**
@ -791,7 +792,8 @@ declare namespace serial {
*/
//% help=serial/write-string
//% weight=87 blockGap=8
//% blockId=serial_writestring block="serial|write string %text" shim=serial::writeString
//% blockId=serial_writestring block="serial|write string %text"
//% text.shadowOptions.toString=true shim=serial::writeString
function writeString(text: string): void;
/**

View File

@ -244,6 +244,7 @@ namespace radio {
//% help=radio/send-string
//% weight=58
//% blockId=radio_datagram_send_string block="radio send string %msg"
//% msg.shadowOptions.toString=true
void sendString(String msg) {
if (radioEnable() != MICROBIT_OK || NULL == msg) return;

View File

@ -30,7 +30,8 @@ declare namespace radio {
*/
//% help=radio/send-string
//% weight=58
//% blockId=radio_datagram_send_string block="radio send string %msg" shim=radio::sendString
//% blockId=radio_datagram_send_string block="radio send string %msg"
//% msg.shadowOptions.toString=true shim=radio::sendString
function sendString(msg: string): void;
/**