Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit062cb27

Browse files
update repl example
1 parentf6793cc commit062cb27

File tree

1 file changed

+10
-8
lines changed

1 file changed

+10
-8
lines changed

‎examples/repl.js‎

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,22 @@
11
/**
2-
*
2+
*
33
* A network based REPL (Read–eval–print loop).
4-
*
4+
*
55
* Usage:
66
* netcat [IP-ADDRESS] 1234
7-
*
7+
*
88
* After successful connection a prompt appears: '>'
99
* Then type [USER]:[PASS] (the defaults are esp32:esp32)
1010
* After successful authentication you will see "====> authorized."
11-
*
12-
* After that you can type every JS expression, which then gets
13-
* evaluated in esp32-javascript and the result is printed.
14-
*
11+
*
12+
* After that you can type every JS expression, which then gets
13+
* evaluated in esp32-javascript and the result is printed.
14+
*
1515
*/
1616
varconfigManager=require("esp32-javascript/config");
1717

1818
varPROMPT="> ";
19+
vartextDecoder=newTextDecoder();
1920

2021
functionwriteOutput(socket,result){
2122
socket.write(result);
@@ -27,7 +28,8 @@ require("socket-events").sockListen(
2728
function(socket){
2829
varauthorized=false;
2930
var_=undefined;
30-
socket.onData=function(data){
31+
socket.onData=function(buffer){
32+
vardata=textDecoder.decode(buffer);
3133
varresult=null;
3234
if(!authorized){
3335
varaccessConfig=configManager.config.access;

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp