pull/346/head
Lucas Nogueira 2 years ago
parent afbc22a3e3
commit a28f82bf6b
No known key found for this signature in database
GPG Key ID: FFEA6C72E73482F1

@ -51,7 +51,7 @@ fn main() {
Afterwards all the plugin's APIs are available through the JavaScript guest bindings: Afterwards all the plugin's APIs are available through the JavaScript guest bindings:
```javascript ```javascript
import * as os from 'tauri-plugin-os-api' import * as os from "tauri-plugin-os-api";
``` ```
## Contributing ## Contributing

@ -21,37 +21,37 @@
* @module * @module
*/ */
import { invoke } from '@tauri-apps/api/tauri' import { invoke } from "@tauri-apps/api/tauri";
type Platform = type Platform =
| 'linux' | "linux"
| 'darwin' | "darwin"
| 'ios' | "ios"
| 'freebsd' | "freebsd"
| 'dragonfly' | "dragonfly"
| 'netbsd' | "netbsd"
| 'openbsd' | "openbsd"
| 'solaris' | "solaris"
| 'android' | "android"
| 'win32' | "win32";
type OsType = 'Linux' | 'Darwin' | 'Windows_NT' type OsType = "Linux" | "Darwin" | "Windows_NT";
type Arch = type Arch =
| 'x86' | "x86"
| 'x86_64' | "x86_64"
| 'arm' | "arm"
| 'aarch64' | "aarch64"
| 'mips' | "mips"
| 'mips64' | "mips64"
| 'powerpc' | "powerpc"
| 'powerpc64' | "powerpc64"
| 'riscv64' | "riscv64"
| 's390x' | "s390x"
| 'sparc64' | "sparc64";
function isWindows(): boolean { function isWindows(): boolean {
return navigator.appVersion.includes('Win') return navigator.appVersion.includes("Win");
} }
/** /**
@ -61,7 +61,7 @@ function isWindows(): boolean {
* *
* @since 1.0.0 * @since 1.0.0
* */ * */
const EOL = isWindows() ? '\r\n' : '\n' const EOL = isWindows() ? "\r\n" : "\n";
/** /**
* Returns a string identifying the operating system platform. * Returns a string identifying the operating system platform.
@ -76,7 +76,7 @@ const EOL = isWindows() ? '\r\n' : '\n'
* *
*/ */
async function platform(): Promise<Platform> { async function platform(): Promise<Platform> {
return invoke('plugin:os|platform') return invoke("plugin:os|platform");
} }
/** /**
@ -90,7 +90,7 @@ async function platform(): Promise<Platform> {
* @since 1.0.0 * @since 1.0.0
*/ */
async function version(): Promise<string> { async function version(): Promise<string> {
return invoke('plugin:os|version') return invoke("plugin:os|version");
} }
/** /**
@ -104,7 +104,7 @@ async function version(): Promise<string> {
* @since 1.0.0 * @since 1.0.0
*/ */
async function type(): Promise<OsType> { async function type(): Promise<OsType> {
return invoke('plugin:os|kind') return invoke("plugin:os|kind");
} }
/** /**
@ -119,7 +119,7 @@ async function type(): Promise<OsType> {
* @since 1.0.0 * @since 1.0.0
*/ */
async function arch(): Promise<Arch> { async function arch(): Promise<Arch> {
return invoke('plugin:os|arch') return invoke("plugin:os|arch");
} }
/** /**
@ -133,8 +133,8 @@ async function arch(): Promise<Arch> {
* @since 1.0.0 * @since 1.0.0
*/ */
async function tempdir(): Promise<string> { async function tempdir(): Promise<string> {
return invoke('plugin:os|tempdir') return invoke("plugin:os|tempdir");
} }
export { EOL, platform, version, type, arch, tempdir } export { EOL, platform, version, type, arch, tempdir };
export type { Platform, OsType, Arch } export type { Platform, OsType, Arch };

Loading…
Cancel
Save