mirror of
https://github.com/ankitects/anki.git
synced 2025-11-06 12:47:11 -05:00
add and use isWindows helper fn
This commit is contained in:
parent
7048730503
commit
c973f0f786
2 changed files with 9 additions and 1 deletions
|
|
@ -1,13 +1,16 @@
|
|||
// Copyright: Ankitects Pty Ltd and contributors
|
||||
// License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
|
||||
|
||||
import { isWindows } from "@tslib/platform";
|
||||
|
||||
export interface PostProtoOptions {
|
||||
/** True by default. Shows a dialog with the error message, then rethrows. */
|
||||
alertOnError?: boolean;
|
||||
// whether to use the "anki:" custom protocol or not
|
||||
customProtocol?: boolean;
|
||||
}
|
||||
|
||||
const CUSTOM_PROTOCOL_URI = (navigator.platform.indexOf("Win") == -1) ? "anki://localhost" : "http://anki.localhost";
|
||||
const CUSTOM_PROTOCOL_URI = isWindows() ? "http://anki.localhost" : "anki://localhost" ;
|
||||
|
||||
export async function postProto<T>(
|
||||
method: string,
|
||||
|
|
|
|||
|
|
@ -10,6 +10,11 @@ export function isApplePlatform(): boolean {
|
|||
);
|
||||
}
|
||||
|
||||
export function isWindows(): boolean {
|
||||
const platform = window.navigator["platform" + ""];
|
||||
return platform.startsWith("Win");
|
||||
}
|
||||
|
||||
export function isDesktop(): boolean {
|
||||
return !(/iphone|ipad|ipod|android/i.test(window.navigator.userAgent));
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue