update
This commit is contained in:
parent
4e17a28519
commit
0d57325ced
@ -129,20 +129,17 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<button onclick="emit('clear')">clear all</button>
|
<button onclick="client.emit('action', {'clear'})">clear all</button>
|
||||||
<br>
|
<br>
|
||||||
<button onclick="emit('hello')">hello</button>
|
<button onclick="client.emit('action', {'hello'})">hello</button>
|
||||||
<br>
|
<br>
|
||||||
<button onclick="emit('flash')">flash</button>
|
<button onclick="client.emit('action', {'flash'})">flash</button>
|
||||||
<br>
|
<br>
|
||||||
<button onclick="emit('temp')">temp</button>
|
<button onclick="client.emit('action', {'temp'})">temp</button>
|
||||||
|
|
||||||
<script src="socket.io/socket.io.js"></script>
|
<script src="socket.io/socket.io.js"></script>
|
||||||
<script>
|
<script>
|
||||||
const client = io()
|
const client = io()
|
||||||
function emit(action) {
|
|
||||||
client.emit('action', { action })
|
|
||||||
}
|
|
||||||
function turnon(led) {
|
function turnon(led) {
|
||||||
const { x, y } = led.dataset
|
const { x, y } = led.dataset
|
||||||
const action = led.classList.toggle('on') ? 'on' : 'off'
|
const action = led.classList.toggle('on') ? 'on' : 'off'
|
||||||
|
Loading…
Reference in New Issue
Block a user