Displaying location info from websocket
This commit is contained in:
26
ui/app/components/LocationList.js
Normal file
26
ui/app/components/LocationList.js
Normal file
@@ -0,0 +1,26 @@
|
||||
class LocationList extends Shadow {
|
||||
list = []
|
||||
|
||||
render() {
|
||||
VStack(() => {
|
||||
this.list.forEach((update) => {
|
||||
console.log(update.name)
|
||||
HStack(() => {
|
||||
p(update.timestamp)
|
||||
p(update.name)
|
||||
p(update.latitude)
|
||||
p(update.longitude)
|
||||
})
|
||||
.gap(1, em)
|
||||
})
|
||||
})
|
||||
.onEvent("update-location", (e) => {
|
||||
console.log("location received: ", e.detail)
|
||||
this.list.unshift(e.detail)
|
||||
this.rerender()
|
||||
})
|
||||
.x(2, em).y(5, em)
|
||||
}
|
||||
}
|
||||
|
||||
window.registerShadow(LocationList)
|
||||
Reference in New Issue
Block a user