platform docs wip

This commit is contained in:
Tim Lancina
2015-08-31 11:19:30 -05:00
parent 407ff62258
commit 4dd9d87ab4

View File

@ -2,6 +2,9 @@ import * as util from '../util/util';
import * as dom from '../util/dom'; import * as dom from '../util/dom';
/**
* TODO
*/
export class PlatformCtrl { export class PlatformCtrl {
constructor() { constructor() {
@ -19,16 +22,30 @@ export class PlatformCtrl {
// Methods // Methods
// ********************************************** // **********************************************
/**
* TODO
* @param {TODO} platformName TODO
* @returns {TODO} TODO
*/
is(platformName) { is(platformName) {
return (this._platforms.indexOf(platformName) > -1); return (this._platforms.indexOf(platformName) > -1);
} }
/**
* TODO
* @returns {TODO} TODO
*/
platforms() { platforms() {
// get the array of active platforms, which also knows the hierarchy, // get the array of active platforms, which also knows the hierarchy,
// with the last one the most important // with the last one the most important
return this._platforms; return this._platforms;
} }
/**
* TODO
* @param {TODO} platformName TODO
* @returns {TODO} TODO
*/
versions(platformName) { versions(platformName) {
if (arguments.length) { if (arguments.length) {
// get a specific platform's version // get a specific platform's version
@ -39,10 +56,19 @@ export class PlatformCtrl {
return this._versions; return this._versions;
} }
/**
* TODO
* @returns {TODO} TODO
*/
ready() { ready() {
return this._readyPromise; return this._readyPromise;
} }
/**
* TODO
* @param {TODO} config TODO
* @returns {TODO} TODO
*/
prepareReady(config) { prepareReady(config) {
let self = this; let self = this;
@ -61,11 +87,19 @@ export class PlatformCtrl {
} }
} }
/**
* TODO
* @returns {TODO} TODO
*/
domReady() { domReady() {
// convenience method so its easy to access on Platform // convenience method so its easy to access on Platform
return dom.ready.apply(this, arguments); return dom.ready.apply(this, arguments);
} }
/**
* TODO
* @returns {TODO} TODO
*/
windowLoad() { windowLoad() {
// convenience method so its easy to access on Platform // convenience method so its easy to access on Platform
return dom.windowLoad.apply(this, arguments); return dom.windowLoad.apply(this, arguments);
@ -163,6 +197,10 @@ export class PlatformCtrl {
// Registry // Registry
// ********************************************** // **********************************************
/**
* TODO
* @param {TODO} platformConfig TODO
*/
register(platformConfig) { register(platformConfig) {
this._registry[platformConfig.name] = platformConfig; this._registry[platformConfig.name] = platformConfig;
} }
@ -175,6 +213,11 @@ export class PlatformCtrl {
this._default = platformName; this._default = platformName;
} }
/**
* TODO
* @param {TODO} queryValue TODO
* @returns {boolean} TODO
*/
testQuery(queryValue) { testQuery(queryValue) {
let val = this.query('ionicplatform'); let val = this.query('ionicplatform');
if (val) { if (val) {
@ -188,11 +231,21 @@ export class PlatformCtrl {
return false; return false;
} }
/**
* TODO
* @param {TODO} userAgentExpression TODO
* @returns {boolean} TODO
*/
testUserAgent(userAgentExpression) { testUserAgent(userAgentExpression) {
let rx = new RegExp(userAgentExpression, 'i'); let rx = new RegExp(userAgentExpression, 'i');
return rx.test(this._ua); return rx.test(this._ua);
} }
/**
* TODO
* @param {TODO} userAgentExpression TODO
* @returns {Object} TODO
*/
matchUserAgentVersion(userAgentExpression) { matchUserAgentVersion(userAgentExpression) {
let val = this._ua.match(userAgentExpression); let val = this._ua.match(userAgentExpression);
if (val) { if (val) {
@ -203,6 +256,12 @@ export class PlatformCtrl {
} }
} }
/**
* TODO
* @param {TODO} queryValue TODO
* @param {TODO} userAgentExpression TODO
* @returns {boolean} TODO
*/
isPlatform(queryValue, userAgentExpression) { isPlatform(queryValue, userAgentExpression) {
if (!userAgentExpression) { if (!userAgentExpression) {
userAgentExpression = queryValue; userAgentExpression = queryValue;
@ -211,6 +270,10 @@ export class PlatformCtrl {
this.testUserAgent(userAgentExpression); this.testUserAgent(userAgentExpression);
} }
/**
* TODO
* @param {TODO} config TODO
*/
load(config) { load(config) {
let rootPlatformNode = null; let rootPlatformNode = null;
let engineNode = null; let engineNode = null;
@ -299,6 +362,11 @@ export class PlatformCtrl {
} }
} }
/**
* TODO
* @param {TODO} platformName TODO
* @returns {TODO} TODO
*/
matchPlatform(platformName) { matchPlatform(platformName) {
// build a PlatformNode and assign config data to it // build a PlatformNode and assign config data to it
// use it's getRoot method to build up its hierarchy // use it's getRoot method to build up its hierarchy
@ -324,6 +392,11 @@ export class PlatformCtrl {
return this._settings; return this._settings;
} }
/**
* TODO
* @param {TODO} platformName TODO
* @returns {string} TODO
*/
get(platformName) { get(platformName) {
return this._registry[platformName] || {}; return this._registry[platformName] || {};
} }
@ -458,4 +531,3 @@ class PlatformNode {
} }
export let Platform = new PlatformCtrl(); export let Platform = new PlatformCtrl();