/*JSON{ "type":"staticmethod", "class":"console", "name" : "log", "description" : "Print the supplied string(s)", "generate" : "jswrap_interface_print", "params" : [ [ "text", "JsVarArray", "One or more arguments to print"] ] }*/ void jswrap_interface_print(JsVar *v) { assert(jsvIsArray(v)); JsArrayIterator it; jsvArrayIteratorNew(&it, v); while (jsvArrayIteratorHasElement(&it)) { JsVar *v = jsvAsString(jsvArrayIteratorGetElement(&it), true); jsiConsoleRemoveInputLine(); jsiConsolePrintStringVar(v); jsvUnLock(v); jsvArrayIteratorNext(&it); if (jsvArrayIteratorHasElement(&it)) jsiConsolePrint(" "); } jsvArrayIteratorFree(&it); jsiConsolePrint("\n"); }
/*JSON{ "type" : "staticmethod", "class" : "console", "name" : "log", "generate" : "jswrap_interface_print", "params" : [ ["text","JsVarArray","One or more arguments to print"] ] } Print the supplied string(s) to the console **Note:** If you're connected to a computer (not a wall adaptor) via USB but **you are not running a terminal app** then when you print data Espruino may pause execution and wait until the computer requests the data it is trying to print. */ void jswrap_interface_print(JsVar *v) { assert(jsvIsArray(v)); jsiConsoleRemoveInputLine(); JsvObjectIterator it; jsvObjectIteratorNew(&it, v); while (jsvObjectIteratorHasValue(&it)) { JsVar *v = jsvObjectIteratorGetValue(&it); if (jsvIsString(v)) jsiConsolePrintStringVar(v); else jsfPrintJSON(v, JSON_PRETTY | JSON_NEWLINES); jsvUnLock(v); jsvObjectIteratorNext(&it); if (jsvObjectIteratorHasValue(&it)) jsiConsolePrint(" "); } jsvObjectIteratorFree(&it); jsiConsolePrint("\n"); }