mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2025-08-19 11:41:20 +08:00
checking in
This commit is contained in:
113
ionic/platform/registry.js
Normal file
113
ionic/platform/registry.js
Normal file
@ -0,0 +1,113 @@
|
||||
import {Platform} from './platform';
|
||||
import {Tap} from '../util/tap';
|
||||
|
||||
|
||||
Platform.register({
|
||||
name: 'core',
|
||||
subsets: [
|
||||
'android',
|
||||
'ios',
|
||||
'windowsphone'
|
||||
]
|
||||
});
|
||||
|
||||
|
||||
Platform.register({
|
||||
name: 'mobile'
|
||||
});
|
||||
|
||||
|
||||
Platform.register({
|
||||
name: 'phablet',
|
||||
isMatch(app) {
|
||||
let smallest = Math.min(app.width(), app.height());
|
||||
let largest = Math.max(app.width(), app.height());
|
||||
// http://www.mydevice.io/devices/
|
||||
return (smallest > 390 && smallest < 520) &&
|
||||
(largest > 620 && largest < 800);
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
Platform.register({
|
||||
name: 'tablet',
|
||||
isMatch(app) {
|
||||
let smallest = Math.min(app.width(), app.height());
|
||||
let largest = Math.max(app.width(), app.height());
|
||||
// http://www.mydevice.io/devices/
|
||||
return (smallest > 460 && smallest < 820) &&
|
||||
(largest > 780 && largest < 1400);
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
Platform.register({
|
||||
name: 'android',
|
||||
superset: 'mobile',
|
||||
subsets: [
|
||||
'phablet',
|
||||
'tablet'
|
||||
],
|
||||
settings: {
|
||||
mode: 'md'
|
||||
},
|
||||
isMatch(app) {
|
||||
return app.matchesPlatform('android');
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
|
||||
Platform.register({
|
||||
name: 'ios',
|
||||
superset: 'mobile',
|
||||
subsets: [
|
||||
'ipad',
|
||||
'iphone'
|
||||
],
|
||||
settings: {
|
||||
mode: 'ios'
|
||||
},
|
||||
isMatch(app) {
|
||||
return app.matchesPlatform('ios');
|
||||
},
|
||||
run() {
|
||||
Tap.run();
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
Platform.register({
|
||||
name: 'ipad',
|
||||
superset: 'tablet',
|
||||
isMatch(app) {
|
||||
return app.matchesPlatform('ipad');
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
Platform.register({
|
||||
name: 'iphone',
|
||||
subsets: [
|
||||
'phablet'
|
||||
],
|
||||
isMatch(app) {
|
||||
return app.matchesPlatform('iphone');
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
Platform.register({
|
||||
name: 'windowsphone',
|
||||
superset: 'mobile',
|
||||
subsets: [
|
||||
'phablet',
|
||||
'tablet'
|
||||
],
|
||||
settings: {
|
||||
mode: 'wp'
|
||||
},
|
||||
isMatch(app) {
|
||||
return app.matchesPlatform('windowsphone', 'windows phone');
|
||||
}
|
||||
});
|
Reference in New Issue
Block a user