@ztimson/momentum
Version:
Client library for momentum
50 lines • 1.73 kB
TypeScript
import { PathEventEmitter } from '@ztimson/utils';
import { Api } from './api';
import { Settings } from './settings';
export type Platform = 'windows' | 'android' | 'ios' | 'mac' | 'linux' | 'unknown';
export declare class Client extends PathEventEmitter {
private api;
private readonly settings;
/** Check if iframed */
get iframe(): boolean;
/** Check if mobile device */
get mobile(): boolean;
private _notifications;
/** Are notifications enabled */
get notifications(): boolean;
private set notifications(value);
private _platform?;
/** Get the current platform type */
get platform(): Platform;
/** Get Push Subscription info */
get pushSubscription(): Promise<PushSubscription | null>;
private _pwa?;
/** Check if running as a PWA */
get pwa(): boolean;
constructor(api: Api, settings: Settings);
/**
* Inject the client theme settings, meta tags & PWA prompt
* @param opts Injection options: reload - use cached settings or reload; pwa - disabled auto pwa prompt
* @return {Promise<void>} Resolves on completion
*/
init(opts?: {
reload?: boolean;
pwa?: boolean;
}): Promise<void>;
/**
* Create UI prompt for user to install as PWA
* @param platform Platform prompt, leave blank to auto-detect
*/
pwaPrompt(platform?: 'android' | 'ios'): void;
/**
* Enable device notifications
* @return {Promise<null>} Resolves on success
*/
enableNotifications(): Promise<null>;
/**
* Disable device notifications
* @return {Promise<void>} Resolves on success
*/
disableNotifications(): Promise<void>;
}
//# sourceMappingURL=client.d.ts.map