mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2025-08-19 03:32:21 +08:00
checking in
This commit is contained in:
@ -42,30 +42,30 @@ export class IonicApp {
|
||||
return this._ua;
|
||||
}
|
||||
|
||||
matchesQuery(queryKey, queryValue) {
|
||||
const val = this.query(queryKey);
|
||||
return !!(val && val == queryValue);
|
||||
matchesQuery(queryValue) {
|
||||
let val = this.query('ionicplatform');
|
||||
if (val) {
|
||||
let valueSplit = val.toLowerCase().split(';');
|
||||
for (let i = 0; i < valueSplit.length; i++) {
|
||||
if (valueSplit[i] == queryValue) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
matchesUserAgent(userAgentExpression) {
|
||||
const rx = new RegExp(userAgentExpression, 'i');
|
||||
let rx = new RegExp(userAgentExpression, 'i');
|
||||
return rx.test(this._ua);
|
||||
}
|
||||
|
||||
matchesPlatform(platformQueryValue, platformUserAgentExpression) {
|
||||
if (!platformUserAgentExpression) {
|
||||
platformUserAgentExpression = platformQueryValue;
|
||||
matchesPlatform(queryValue, userAgentExpression) {
|
||||
if (!userAgentExpression) {
|
||||
userAgentExpression = queryValue;
|
||||
}
|
||||
return this.matchesQuery('ionicplatform', platformQueryValue) ||
|
||||
this.matchesUserAgent(platformUserAgentExpression);
|
||||
}
|
||||
|
||||
matchesDevice(deviceQueryValue, deviceUserAgentExpression) {
|
||||
if (!deviceUserAgentExpression) {
|
||||
deviceUserAgentExpression = deviceQueryValue;
|
||||
}
|
||||
return this.matchesQuery('ionicdevice', deviceQueryValue) ||
|
||||
this.matchesUserAgent(deviceUserAgentExpression);
|
||||
return this.matchesQuery(queryValue) ||
|
||||
this.matchesUserAgent(userAgentExpression);
|
||||
}
|
||||
|
||||
width(val) {
|
||||
@ -143,7 +143,7 @@ export function ionicBootstrap(ComponentType, config) {
|
||||
app.width(window.innerWidth);
|
||||
app.height(window.innerHeight);
|
||||
|
||||
let platform = Platform.getActivePlatform(app);
|
||||
let platform = Platform.create(app);
|
||||
|
||||
config = config || new IonicConfig();
|
||||
config.platform(platform);
|
||||
@ -159,8 +159,7 @@ export function ionicBootstrap(ComponentType, config) {
|
||||
bootstrap(ComponentType, injectableBindings).then(appRef => {
|
||||
app.ref(appRef);
|
||||
|
||||
let rootPlatform = platform.root();
|
||||
rootPlatform.runAll();
|
||||
platform.run();
|
||||
|
||||
resolve({
|
||||
app,
|
||||
|
@ -155,25 +155,16 @@ export function main(ionicBootstrap) {
|
||||
'tabBarPlacement': 'adam'
|
||||
});
|
||||
|
||||
// myConfig.platform('ios', {
|
||||
// 'tabBarPlacement': 'ios'
|
||||
// });
|
||||
|
||||
// myConfig.device('ipad', {
|
||||
// 'tabBarPlacement': 'ipad'
|
||||
// });
|
||||
|
||||
// myConfig.platform('android', {
|
||||
// 'tabBarPlacement': 'android'
|
||||
// });
|
||||
|
||||
ionicBootstrap(MyApp, myConfig).then(root => {
|
||||
|
||||
console.log('mobile', root.platform.is('mobile'))
|
||||
console.log('ipad', root.platform.is('ipad'))
|
||||
console.log('iphone', root.platform.is('iphone'))
|
||||
console.log('phablet', root.platform.is('phablet'))
|
||||
console.log('tablet', root.platform.is('tablet'))
|
||||
console.log('ios', root.platform.is('ios'))
|
||||
console.log('android', root.platform.is('android'))
|
||||
console.log('windows phone', root.platform.is('windowsphone'))
|
||||
|
||||
});
|
||||
}
|
||||
|
Reference in New Issue
Block a user