123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174 |
- import { NgZone } from '@angular/core';
- import type { BackButtonEventDetail, KeyboardEventDetail, Platforms } from '@ionic/core/components';
- import { Subscription, Subject } from 'rxjs';
- import * as i0 from "@angular/core";
- export interface BackButtonEmitter extends Subject<BackButtonEventDetail> {
- subscribeWithPriority(priority: number, callback: (processNextHandler: () => void) => Promise<any> | void): Subscription;
- }
- export declare class Platform {
- private doc;
- private _readyPromise;
- private win;
- /**
- * @hidden
- */
- backButton: BackButtonEmitter;
- /**
- * The keyboardDidShow event emits when the
- * on-screen keyboard is presented.
- */
- keyboardDidShow: Subject<KeyboardEventDetail>;
- /**
- * The keyboardDidHide event emits when the
- * on-screen keyboard is hidden.
- */
- keyboardDidHide: Subject<void>;
- /**
- * The pause event emits when the native platform puts the application
- * into the background, typically when the user switches to a different
- * application. This event would emit when a Cordova app is put into
- * the background, however, it would not fire on a standard web browser.
- */
- pause: Subject<void>;
- /**
- * The resume event emits when the native platform pulls the application
- * out from the background. This event would emit when a Cordova app comes
- * out from the background, however, it would not fire on a standard web browser.
- */
- resume: Subject<void>;
- /**
- * The resize event emits when the browser window has changed dimensions. This
- * could be from a browser window being physically resized, or from a device
- * changing orientation.
- */
- resize: Subject<void>;
- constructor(doc: any, zone: NgZone);
- /**
- * @returns returns true/false based on platform.
- * @description
- * Depending on the platform the user is on, `is(platformName)` will
- * return `true` or `false`. Note that the same app can return `true`
- * for more than one platform name. For example, an app running from
- * an iPad would return `true` for the platform names: `mobile`,
- * `ios`, `ipad`, and `tablet`. Additionally, if the app was running
- * from Cordova then `cordova` would be true, and if it was running
- * from a web browser on the iPad then `mobileweb` would be `true`.
- *
- * ```
- * import { Platform } from 'ionic-angular';
- *
- * @Component({...})
- * export MyPage {
- * constructor(public platform: Platform) {
- * if (this.platform.is('ios')) {
- * // This will only print when on iOS
- * console.log('I am an iOS device!');
- * }
- * }
- * }
- * ```
- *
- * | Platform Name | Description |
- * |-----------------|------------------------------------|
- * | android | on a device running Android. |
- * | capacitor | on a device running Capacitor. |
- * | cordova | on a device running Cordova. |
- * | ios | on a device running iOS. |
- * | ipad | on an iPad device. |
- * | iphone | on an iPhone device. |
- * | phablet | on a phablet device. |
- * | tablet | on a tablet device. |
- * | electron | in Electron on a desktop device. |
- * | pwa | as a PWA app. |
- * | mobile | on a mobile device. |
- * | mobileweb | on a mobile device in a browser. |
- * | desktop | on a desktop device. |
- * | hybrid | is a cordova or capacitor app. |
- *
- */
- is(platformName: Platforms): boolean;
- /**
- * @returns the array of platforms
- * @description
- * Depending on what device you are on, `platforms` can return multiple values.
- * Each possible value is a hierarchy of platforms. For example, on an iPhone,
- * it would return `mobile`, `ios`, and `iphone`.
- *
- * ```
- * import { Platform } from 'ionic-angular';
- *
- * @Component({...})
- * export MyPage {
- * constructor(public platform: Platform) {
- * // This will print an array of the current platforms
- * console.log(this.platform.platforms());
- * }
- * }
- * ```
- */
- platforms(): string[];
- /**
- * Returns a promise when the platform is ready and native functionality
- * can be called. If the app is running from within a web browser, then
- * the promise will resolve when the DOM is ready. When the app is running
- * from an application engine such as Cordova, then the promise will
- * resolve when Cordova triggers the `deviceready` event.
- *
- * The resolved value is the `readySource`, which states which platform
- * ready was used. For example, when Cordova is ready, the resolved ready
- * source is `cordova`. The default ready source value will be `dom`. The
- * `readySource` is useful if different logic should run depending on the
- * platform the app is running from. For example, only Cordova can execute
- * the status bar plugin, so the web should not run status bar plugin logic.
- *
- * ```
- * import { Component } from '@angular/core';
- * import { Platform } from 'ionic-angular';
- *
- * @Component({...})
- * export MyApp {
- * constructor(public platform: Platform) {
- * this.platform.ready().then((readySource) => {
- * console.log('Platform ready from', readySource);
- * // Platform now ready, execute any required native code
- * });
- * }
- * }
- * ```
- */
- ready(): Promise<string>;
- /**
- * Returns if this app is using right-to-left language direction or not.
- * We recommend the app's `index.html` file already has the correct `dir`
- * attribute value set, such as `<html dir="ltr">` or `<html dir="rtl">`.
- * [W3C: Structural markup and right-to-left text in HTML](http://www.w3.org/International/questions/qa-html-dir)
- */
- get isRTL(): boolean;
- /**
- * Get the query string parameter
- */
- getQueryParam(key: string): string | null;
- /**
- * Returns `true` if the app is in landscape mode.
- */
- isLandscape(): boolean;
- /**
- * Returns `true` if the app is in portrait mode.
- */
- isPortrait(): boolean;
- testUserAgent(expression: string): boolean;
- /**
- * Get the current url.
- */
- url(): string;
- /**
- * Gets the width of the platform's viewport using `window.innerWidth`.
- */
- width(): number;
- /**
- * Gets the height of the platform's viewport using `window.innerHeight`.
- */
- height(): number;
- static ɵfac: i0.ɵɵFactoryDeclaration<Platform, never>;
- static ɵprov: i0.ɵɵInjectableDeclaration<Platform>;
- }
|