mirror of
https://github.com/directus/directus.git
synced 2026-02-10 20:04:55 -05:00
23 lines
399 B
TypeScript
23 lines
399 B
TypeScript
import { createStore } from 'pinia';
|
|
|
|
type Latency = {
|
|
latency: number;
|
|
timestamp: Date;
|
|
};
|
|
|
|
export const useLatencyStore = createStore({
|
|
id: 'latencyStore',
|
|
state: () => ({
|
|
latency: [] as Latency[],
|
|
}),
|
|
actions: {
|
|
async dehydrate() {
|
|
this.reset();
|
|
},
|
|
save(latency: Latency) {
|
|
this.state.latency.push(latency);
|
|
this.state.latency = this.state.latency.slice(-20);
|
|
},
|
|
},
|
|
});
|