@microsoft/teams-js
Version:
Microsoft Client SDK for building app for Microsoft hosts
69 lines (68 loc) • 2.24 kB
TypeScript
/**
* Module to interact with the geoLocation module-specific part of the SDK. This is the newer version of location module.
*
* @beta
* @module
*/
import * as map from './map';
/**
* Data struture to represent the location information
*
* @beta
*/
export interface Location {
/**
Latitude of the location
*/
latitude: number;
/**
Longitude of the location
*/
longitude: number;
/**
Accuracy describes the maximum distance in meters from the captured coordinates to the possible actual location
@remarks
This property is only in scope for mobile
*/
accuracy?: number;
/**
Time stamp when the location was captured
*/
timestamp?: number;
}
/**
* Fetches current user coordinates
* @returns Promise that will resolve with {@link geoLocation.Location} object or reject with an error. Function can also throw a NOT_SUPPORTED_ON_PLATFORM error
*
* @beta
*/
export declare function getCurrentLocation(): Promise<Location>;
/**
* Checks whether or not location has user permission
*
* @returns Promise that will resolve with true if the user had granted the app permission to location information, or with false otherwise,
* In case of an error, promise will reject with the error. Function can also throw a NOT_SUPPORTED_ON_PLATFORM error
*
* @beta
*/
export declare function hasPermission(): Promise<boolean>;
/**
* Requests user permission for location
*
* @returns true if the user consented permission for location, false otherwise
* @returns Promise that will resolve with true if the user consented permission for location, or with false otherwise,
* In case of an error, promise will reject with the error. Function can also throw a NOT_SUPPORTED_ON_PLATFORM error
*
* @beta
*/
export declare function requestPermission(): Promise<boolean>;
/**
* Checks if geoLocation capability is supported by the host
* @returns boolean to represent whether geoLocation is supported
*
* @throws Error if {@linkcode app.initialize} has not successfully completed
*
* @beta
*/
export declare function isSupported(): boolean;
export { map };