From 2e2be91196221d7593b1fac8cbba86a066722cea Mon Sep 17 00:00:00 2001 From: Adam Bradley Date: Thu, 3 Mar 2016 21:17:44 -0600 Subject: [PATCH] docs(platform): add to `is()` description Closes #5699 --- ionic/platform/platform.ts | 58 ++++++++++++++++++++++++++++---------- 1 file changed, 43 insertions(+), 15 deletions(-) diff --git a/ionic/platform/platform.ts b/ionic/platform/platform.ts index 60092adc0f..e9fc1820d3 100644 --- a/ionic/platform/platform.ts +++ b/ionic/platform/platform.ts @@ -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');