mirror of
https://gitlab.com/wgp/dougal/software.git
synced 2025-12-06 10:07:08 +00:00
Add Vuex position and timestamp getters for real-time event
This commit is contained in:
@@ -32,4 +32,19 @@ function point (state) {
|
||||
return Number(v) || v;
|
||||
}
|
||||
|
||||
export default { serverEvent, online, lineName, sequence, line, point };
|
||||
function position (state) {
|
||||
const λ = Number(_(state, "serverEvent.payload.new.meta.longitude"));
|
||||
const φ = Number(_(state, "serverEvent.payload.new.meta.latitude"));
|
||||
|
||||
if (!isNaN(λ) && !isNaN(φ)) {
|
||||
return [ λ, φ ];
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
function timestamp (state) {
|
||||
const v = _(state, "serverEvent.payload.new.meta.time");
|
||||
return v;
|
||||
}
|
||||
|
||||
export default { serverEvent, online, lineName, sequence, line, point, position, timestamp };
|
||||
|
||||
Reference in New Issue
Block a user