Sample files for Android app Exec JS V8 see Google playstore https://play.google.com/store/apps/details?id=de.mlauer.v8test
The app has full ECMAScript 2016 (ECMA-262) support.
- console.log()
- console.error()
- console.warn()
- _read()
- _write()
- _inputForm()
console.log(data)
Prints to result view
Text color: blue
console.error(data)
Prints to result view
Text color: red
_read(filename, [convert])
Read filename and return content as string
filename
filename,String
convert
optional: convert from iso8859 to utf-8 ,Number 0(default) or 1
_write(filename, content)
Write content to file
_inputForm(title, default) Open a input dialog.
title
title of the dialog,String
default
default value of the input field,String
- mqtt.connect()
- mqtt.publish()
- mqtt.subscribe()
- mqtt.disconnect()
- mqtt.onMqttMessage()
mqtt.connect(url, clientId, options)
Connects to the broker specified by the given url and options
url
broker url,String
examples:
tcp://test.mosquitto.org:1883
ssl://test.mosquitto.org:8883
clientId
id of the client,String
options
server options,JSON - String
mqtt.publish(topic, payload, qos, retain)
Publish a message to a topic
topic
is the topic to publish to,String
payload
is the message to publish,String
qos
QoS level,Number
retain
retain flag,Boolean
mqtt.subscribe(topic, qos)
Subscribe to a topic
topic
is the topic to publish to,String
qos
QoS level,Number
mqtt.disconnect()
Disconnect from the broker
mqtt.onMqttMessage(callback)
Callback function fired when message arrives
callback - function (topic, payload)
- fcm.publish()
fcm.publish(serverKey, message)
Publish a Firebase cloud message
serverKey
your server keyt,String
message
message to publisg,JSON - String
- http.request()
http.request(options)
Execute a http/https request
options
http request options as JSON string,String
Example file v8http_httpbin_get.js
Example file v8http_httpbin_post.js
Example file v8http_httpbin_basicauth.js
Example file v8http_httpbin_bearerauth.js
Example file v8http_httpbin_headers.js
You are welcome to share your code example in the Show and tell GitHub discussion area.