mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2025-08-21 13:01:01 +08:00
@ -13,7 +13,9 @@ import {Config} from '../config/config';
|
|||||||
* @usage
|
* @usage
|
||||||
* ```ts
|
* ```ts
|
||||||
* import {Platform} from 'ionic-angular';
|
* import {Platform} from 'ionic-angular';
|
||||||
* export MyClass {
|
*
|
||||||
|
* @Page({...})
|
||||||
|
* export MyPage {
|
||||||
* constructor(platform: Platform){
|
* constructor(platform: Platform){
|
||||||
* this.platform = platform;
|
* this.platform = platform;
|
||||||
* }
|
* }
|
||||||
@ -52,18 +54,40 @@ export class Platform {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @param {string} platformName
|
* @param {string} platformName
|
||||||
* @returns {boolean} returns true/false based on platform you place
|
* @returns {boolean} returns true/false based on platform.
|
||||||
* @description
|
* @description
|
||||||
* Depending on the platform name, isPlatform will return true or flase
|
* 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 then `mobileweb` would also
|
||||||
|
* be `true`.
|
||||||
|
*
|
||||||
|
* Possible built-in platform names:
|
||||||
|
*
|
||||||
|
* - `android`
|
||||||
|
* - `cordova`
|
||||||
|
* - `core`
|
||||||
|
* - `ios`
|
||||||
|
* - `ipad`
|
||||||
|
* - `iphone`
|
||||||
|
* - `mobile`
|
||||||
|
* - `mobileweb`
|
||||||
|
* - `phablet`
|
||||||
|
* - `tablet`
|
||||||
|
* - `windows`
|
||||||
*
|
*
|
||||||
* ```
|
* ```
|
||||||
* import {Platform} from 'ionic-angular';
|
* import {Platform} from 'ionic-angular';
|
||||||
* export MyClass {
|
*
|
||||||
|
* @Page({...})
|
||||||
|
* export MyPage {
|
||||||
* constructor(platform: Platform) {
|
* constructor(platform: Platform) {
|
||||||
* this.platform = platform;
|
* if (platform.is('ios')) {
|
||||||
* if(this.platform.is('ios'){
|
* // what ever you need to do
|
||||||
* // what ever you need to do for
|
* // if the platform is ios
|
||||||
* // if the platfomr is ios
|
|
||||||
* }
|
* }
|
||||||
* }
|
* }
|
||||||
* }
|
* }
|
||||||
@ -82,7 +106,7 @@ export class Platform {
|
|||||||
*
|
*
|
||||||
* ```
|
* ```
|
||||||
* import {Platform} from 'ionic-angular';
|
* import {Platform} from 'ionic-angular';
|
||||||
* export MyClass {
|
* export MyPage {
|
||||||
* constructor(platform: Platform) {
|
* constructor(platform: Platform) {
|
||||||
* this.platform = platform;
|
* this.platform = platform;
|
||||||
* console.log(this.platform.platforms());
|
* console.log(this.platform.platforms());
|
||||||
@ -104,7 +128,9 @@ export class Platform {
|
|||||||
*
|
*
|
||||||
* ```
|
* ```
|
||||||
* import {Platform} from 'ionic-angular';
|
* import {Platform} from 'ionic-angular';
|
||||||
* export MyClass {
|
*
|
||||||
|
* @Page({...})
|
||||||
|
* export MyPage {
|
||||||
* constructor(platform: Platform) {
|
* constructor(platform: Platform) {
|
||||||
* this.platform = platform;
|
* this.platform = platform;
|
||||||
* console.log(this.platform.versions());
|
* console.log(this.platform.versions());
|
||||||
@ -143,7 +169,9 @@ export class Platform {
|
|||||||
*
|
*
|
||||||
* ```
|
* ```
|
||||||
* import {Platform} from 'ionic-angular';
|
* import {Platform} from 'ionic-angular';
|
||||||
* export MyClass {
|
*
|
||||||
|
* @Page({...})
|
||||||
|
* export MyPage {
|
||||||
* constructor(platform: Platform) {
|
* constructor(platform: Platform) {
|
||||||
* this.platform = platform;
|
* this.platform = platform;
|
||||||
* this.platform.ready().then(() => {
|
* this.platform.ready().then(() => {
|
||||||
|
Reference in New Issue
Block a user