Alex Perry | d5e1357 | 2020-02-22 15:15:08 -0800 | [diff] [blame] | 1 | import {Ping} from 'aos/events/ping_generated'; |
Alex Perry | 5f474f2 | 2020-02-01 12:14:24 -0800 | [diff] [blame] | 2 | |
| 3 | export function HandlePing(data: Uint8Array) { |
| 4 | const fbBuffer = new flatbuffers.ByteBuffer(data); |
Alex Perry | d5e1357 | 2020-02-22 15:15:08 -0800 | [diff] [blame] | 5 | const ping = Ping.getRootAsPing(fbBuffer); |
Alex Perry | 5f474f2 | 2020-02-01 12:14:24 -0800 | [diff] [blame] | 6 | |
| 7 | document.getElementById('val').innerHTML = ping.value(); |
| 8 | document.getElementById('time').innerHTML = ping.sendTime().low; |
| 9 | } |
| 10 | |
| 11 | export 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 | |
| 24 | export function GetId() { |
| 25 | return aos.examples.Ping.getFullyQualifiedName(); |
| 26 | } |