@vertigis/viewer-spec
Version:
VertiGIS Viewer Specification
92 lines (91 loc) • 2.69 kB
TypeScript
import type { Command } from "../Command.js";
import { CommandRegistry } from "../CommandRegistry.js";
import type { Event } from "../Event.js";
import { EventRegistry } from "../EventRegistry.js";
import type { Operation } from "../Operation.js";
import { OperationRegistry } from "../OperationRegistry.js";
/**
* The status of a connection to a network host.
*/
export type NetworkStatus = "NoConnection" | "ConnectedToCarrierDataNetwork" | "ConnectedToWiFiOrEthernet" | "Restricted";
/**
* Arguments for the network.can-reach-host operation.
*/
export interface HostAndPortArgs {
/**
* The host to connect to.
*/
host: string;
/**
* The port number to connect to. Must be an integer.
*/
port: number;
}
export declare class NetworkCommands extends CommandRegistry {
protected readonly _prefix = "network";
/**
* Turns on Disconnected Mode which prevents the app from making web
* requests independent of the device's network connectivity.
*
* @mobileOnly
*/
get disableWebRequests(): Command<void>;
/**
* Turns off Disconnected Mode allowing the device to make web requests if
* it has a network connection.
*
* @mobileOnly
*/
get enableWebRequests(): Command<void>;
}
export declare class NetworkEvents extends EventRegistry {
protected readonly _prefix = "network";
/**
* Raised when the user has blocked the app from making web requests. Mobile
* only.
*
* @mobileOnly
*/
get webRequestsDisabled(): Event;
/**
* Raised when the user has allowed the app to make web requests. Mobile
* only.
*
* @mobileOnly
*/
get webRequestsEnabled(): Event;
}
export declare class NetworkOperations extends OperationRegistry {
protected readonly _prefix = "network";
/**
* Determines if Disconnected Mode is enabled and web requests can be sent
* by the app.
*
* @mobileOnly
*/
get areWebRequestsDisabled(): Operation<void, boolean>;
/**
* Determines if the device has a network connection. Mobile only.
*
* @mobileOnly
*/
get hasConnection(): Operation<void, boolean>;
/**
* Returns the network status. Mobile only.
*
* @mobileOnly
*/
get getStatus(): Operation<void, NetworkStatus>;
/**
* Determines if the device can reach a given host and port. Mobile only.
*
* @mobileOnly
*/
get canReachHost(): Operation<HostAndPortArgs, boolean>;
/**
* Determines if the device can reach a given url. Mobile only.
*
* @mobileOnly
*/
get canReachUrl(): Operation<string, boolean>;
}