docs(): add platform docs

This commit is contained in:
mhartington
2018-08-22 10:16:22 -04:00
parent b387de4bbd
commit 6718662f5e
2 changed files with 43 additions and 0 deletions

View File

@ -0,0 +1,25 @@
# platform
The Platform service can be used to get information about your current device. You can get all of the platforms associated with the device using the platforms method, including whether the app is being viewed from a tablet, if it's on a mobile device or browser, and the exact platform (iOS, Android, etc). You can also get the orientation of the device, if it uses right-to-left language direction, and much much more. With this information you can completely customize your app to fit any device.
<!-- Auto Generated Below -->
## Methods
| Method | Description |
|---------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `is` | Returns true/false based on platform. Available options are android, cordova, core, ios, ipad, iphone, mobile, mobileweb, phablet, tablet, windows, electron. |
| `platforms` | Returns an array of platforms that the current device matches. |
| `versions` | Returns an object that contains the major, minor, and patcher version of the current device. |
| `ready` | Returns a promise that resolves when the native bridge is ready in Cordova, or when the DOM is fully loaded in the browser. |
| `isLandscape` | Returns true of false if the device is in landscape. |
| `isPortrait` | Returns true of false if the device is in portrait. |
----------------------------------------------
*Built with [StencilJS](https://stenciljs.com/)*

View File

@ -0,0 +1,18 @@
```typescript
import { Component } from '@angular/core';
import { Platform } from '@ionic/angular';
@Component({
selector: 'platform-example',
templateUrl: 'platform-example.html',
styleUrls: ['./platform-example.css']
})
export class PlatformExample {
constructor(public plt: Platform) {
if (this.plt.is('ios')) {
// This will only print when on iOS
console.log('I am an iOS device!');
}
}
}
```