blob: df7635d84c0d275546b4dcfcd72b704520f46c01 [file] [log] [blame]
Alex Perryd5e13572020-02-22 15:15:08 -08001import {Ping} from 'aos/events/ping_generated';
Alex Perry5f474f22020-02-01 12:14:24 -08002
3export function HandlePing(data: Uint8Array) {
4 const fbBuffer = new flatbuffers.ByteBuffer(data);
Alex Perryd5e13572020-02-22 15:15:08 -08005 const ping = Ping.getRootAsPing(fbBuffer);
Alex Perry5f474f22020-02-01 12:14:24 -08006
7 document.getElementById('val').innerHTML = ping.value();
8 document.getElementById('time').innerHTML = ping.sendTime().low;
9}
10
11export function SetupDom() {
12 const ping_div = document.createElement('div');
13 document.body.appendChild(ping_div);
14
15 const value_div = document.createElement('div');
16 value_div.setAttribute('id', 'val');
17 const time_div = document.createElement('div');
18 time_div.setAttribute('id', 'time');
19
20 ping_div.appendChild(value_div);
21 ping_div.appendChild(time_div);
22}
23
24export function GetId() {
25 return aos.examples.Ping.getFullyQualifiedName();
26}