mirror of
https://github.com/tauri-apps/plugins-workspace.git
synced 2026-05-25 13:17:47 +02:00
cf4d7d4e6c
* chore: adjust prettier config, .gitignore and use taplo to format toml files This brings the plugins-workspace repository to the same code style of the main tauri repo * format toml * ignore examples gen dir * add .vscode/extensions.json * remove packageManager field * fmt * fix audit * taplo ignore permissions autogenerated files * remove create dummy dist * fix prettier workflow * install fmt in prettier workflow --------- Co-authored-by: Lucas Nogueira <lucas@tauri.app>
38 lines
894 B
TypeScript
38 lines
894 B
TypeScript
// Copyright 2019-2023 Tauri Programme within The Commons Conservancy
|
|
// SPDX-License-Identifier: Apache-2.0
|
|
// SPDX-License-Identifier: MIT
|
|
|
|
/* eslint-disable @typescript-eslint/unbound-method */
|
|
|
|
import { Channel } from '@tauri-apps/api/core'
|
|
import { commands, type PositionOptions, type Position } from './bindings'
|
|
|
|
export async function watchPosition(
|
|
options: PositionOptions,
|
|
// TODO: This can receive errors too
|
|
cb: (location: Position | string) => void
|
|
): Promise<number> {
|
|
const channel = new Channel<Position>()
|
|
channel.onmessage = cb
|
|
await commands.watchPosition(options, channel)
|
|
return channel.id
|
|
}
|
|
|
|
export const {
|
|
getCurrentPosition,
|
|
clearWatch,
|
|
checkPermissions,
|
|
requestPermissions
|
|
} = commands
|
|
|
|
export type {
|
|
PermissionState,
|
|
PermissionStatus,
|
|
PermissionType,
|
|
Position,
|
|
PositionOptions,
|
|
Coordinates
|
|
} from './bindings'
|
|
|
|
// export { events };
|