mirror of
https://github.com/owntracks/frontend.git
synced 2026-05-13 03:46:33 +00:00
Use TypeScript interface for websocket calllback
This commit is contained in:
@@ -1,12 +1,6 @@
|
||||
import { log, logLevels } from "@/logging";
|
||||
import { getApiUrl } from "@/util";
|
||||
|
||||
/**
|
||||
* Callback for new WebSocket location messages.
|
||||
*
|
||||
* @callback webSocketLocationCallback
|
||||
*/
|
||||
|
||||
/**
|
||||
* Fetch an API resource.
|
||||
*
|
||||
@@ -145,7 +139,7 @@ export const getLocationHistory = async (devices, start, end) => {
|
||||
* Connect to the WebSocket API, reconnect when necessary and handle received
|
||||
* messages.
|
||||
*
|
||||
* @param {webSocketLocationCallback} [callback] Callback for location messages
|
||||
* @param {WebSocketLocationCallback} [callback] Callback for location messages
|
||||
*/
|
||||
export const connectWebsocket = async callback => {
|
||||
let url = getApiUrl("/ws/last");
|
||||
|
||||
3
src/index.d.ts
vendored
3
src/index.d.ts
vendored
@@ -201,6 +201,9 @@ interface QueryParams {
|
||||
layers?: string;
|
||||
}
|
||||
|
||||
/** Callback for new WebSocket location messages. */
|
||||
interface WebSocketLocationCallback { (): void }
|
||||
|
||||
/** A CSS color. */
|
||||
type Color = string;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user