docs(platform): add to is() description

Closes #5699
This commit is contained in:
Adam Bradley
2016-03-03 21:17:44 -06:00
parent bd1173284b
commit 2e2be91196

View File

@ -13,7 +13,9 @@ import {Config} from '../config/config';
* @usage
* ```ts
* import {Platform} from 'ionic-angular';
* export MyClass {
*
* @Page({...})
* export MyPage {
* constructor(platform: Platform){
* this.platform = platform;
* }
@ -52,18 +54,40 @@ export class Platform {
/**
* @param {string} platformName
* @returns {boolean} returns true/false based on platform you place
* @returns {boolean} returns true/false based on platform.
* @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';
* export MyClass {
* constructor(platform: Platform){
* this.platform = platform;
* if(this.platform.is('ios'){
* // what ever you need to do for
* // if the platfomr is ios
*
* @Page({...})
* export MyPage {
* constructor(platform: Platform) {
* if (platform.is('ios')) {
* // what ever you need to do
* // if the platform is ios
* }
* }
* }
@ -82,8 +106,8 @@ export class Platform {
*
* ```
* import {Platform} from 'ionic-angular';
* export MyClass {
* constructor(platform: Platform){
* export MyPage {
* constructor(platform: Platform) {
* this.platform = platform;
* console.log(this.platform.platforms());
* // This will return an array of all the availble platforms
@ -104,8 +128,10 @@ export class Platform {
*
* ```
* import {Platform} from 'ionic-angular';
* export MyClass {
* constructor(platform: Platform){
*
* @Page({...})
* export MyPage {
* constructor(platform: Platform) {
* this.platform = platform;
* console.log(this.platform.versions());
* }
@ -143,8 +169,10 @@ export class Platform {
*
* ```
* import {Platform} from 'ionic-angular';
* export MyClass {
* constructor(platform: Platform){
*
* @Page({...})
* export MyPage {
* constructor(platform: Platform) {
* this.platform = platform;
* this.platform.ready().then(() => {
* console.log('Platform ready');