本文整理汇总了TypeScript中ionic-angular.Platform.is方法的典型用法代码示例。如果您正苦于以下问题:TypeScript Platform.is方法的具体用法?TypeScript Platform.is怎么用?TypeScript Platform.is使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ionic-angular.Platform
的用法示例。
在下文中一共展示了Platform.is方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: bledeviceChanged
bledeviceChanged(value) {
this.blescan = false;
this.datastream = [];
if (this.platform.is('mobile')) {
BluetoothSerial.connect(value).then(
value => {
this.datastream.push("connect ok:" + JSON.stringify(value));
console.log(value);
this.watcher = BluetoothSerial.subscribe('\n').subscribe(
(data) => {
this.datastream.push("subscribe data:" + JSON.stringify(data));
this.userData.setBluetoothData(data);
console.log("subscribe data" + data);
},
(err) => {
this.datastream.push("subscribe err:" + JSON.stringify(data));
console.log("subscribeRaw err:" + data);
}
);
},
err => {
this.datastream.push("connect err:" + JSON.stringify(err));
console.error(err);
}
);
} else {
var data = '{\"id\":\"0000000001\",\"pr\":127,\"tp\":22.0,\"ba\":2.95}\r\n';
this.datastream.push(JSON.stringify(data));
this.userData.setBluetoothData(data);
}
}
示例2: constructor
constructor(
public platform: Platform,
public elementRef: ElementRef,
public renderer: Renderer) {
this.isAndroid = platform.is('android');
renderer.setElementAttribute(elementRef.nativeElement, 'primary', this.isAndroid ? '' : null);
}
示例3: openMenu
openMenu() {
let actionSheet = ActionSheet.create({
title: 'Albums',
cssClass: 'action-sheets-basic-page',
buttons: [
{
text: 'Delete',
role: 'destructive',
icon: !this.platform.is('ios') ? 'trash' : null,
handler: () => {
console.log('Delete clicked');
}
},
{
text: 'Share',
icon: !this.platform.is('ios') ? 'share' : null,
handler: () => {
console.log('Share clicked');
}
},
{
text: 'Play',
icon: !this.platform.is('ios') ? 'arrow-dropright-circle' : null,
handler: () => {
console.log('Play clicked');
}
},
{
text: 'Favorite',
icon: !this.platform.is('ios') ? 'heart-outline' : null,
handler: () => {
console.log('Favorite clicked');
}
},
{
text: 'Cancel',
role: 'cancel', // will always sort to be on the bottom
icon: !this.platform.is('ios') ? 'close' : null,
handler: () => {
console.log('Cancel clicked');
}
}
]
});
this.nav.present(actionSheet);
}
示例4: ionViewDidLoad
ionViewDidLoad() {
if (this.platform.is('cordova') === true) {
let mapEle = document.getElementById('map_canvas');
this.confData.getMap().subscribe(mapData => {
this.map = new GoogleMap('map_canvas');
mapEle.classList.add('show-map');
GoogleMap.isAvailable().then(() => {
mapData.find(data => {
const position = new GoogleMapsLatLng(43.074395, -89.381056);
this.map.animateCamera({
target: position,
zoom: 16
}).then(() => {
mapData.forEach(markerData => {
const markerOptions: GoogleMapsMarkerOptions = {
position: markerData,
title: markerData.name
};
this.map.addMarker(markerOptions);
});
});
});
});
});
} else {
this.confData.getMap().subscribe(mapData => {
let mapEle = document.getElementById('map_canvas');
let map = new google.maps.Map(mapEle, {
center: mapData.find(d => d.center),
zoom: 16
});
mapData.forEach(markerData => {
let infoWindow = new google.maps.InfoWindow({
content: `<h5>${markerData.name}</h5>`
});
let marker = new google.maps.Marker({
position: markerData,
map: map,
title: markerData.name
});
marker.addListener('click', () => {
infoWindow.open(map, marker);
});
});
google.maps.event.addListenerOnce(map, 'idle', () => {
mapEle.classList.add('show-map');
});
});
}
}
示例5: reviewApp
reviewApp() {
if(this.platform.is('ios')) {
window.open(`itms-apps://itunes.apple.com/app/viewContentsUserReviews/id1186113597`, '_system');
}
else {
this.appRate.promptForRating(true);
}
}
示例6:
platform.ready().then(() => {
// Okay, so the platform is ready and our plugins are available.
// Here you can do any higher level native things you might need.
if (platform.is('cordova')) {
StatusBar.styleDefault();
Splashscreen.hide();
}
});
示例7: openMenu
openMenu() {
let actionSheet = this.actionsheetCtrl.create({
title: "Albums",
cssClass: "action-sheets-basic-page",
buttons: [
{
text: "Delete",
role: "destructive",
icon: !this.platform.is("ios") ? "trash" : null,
handler: () => {
console.log("Delete clicked");
}
},
{
text: "Share",
icon: !this.platform.is("ios") ? "share" : null,
handler: () => {
console.log("Share clicked");
}
},
{
text: "Play",
icon: !this.platform.is("ios") ? "arrow-dropright-circle" : null,
handler: () => {
console.log("Play clicked");
}
},
{
text: "Favorite",
icon: !this.platform.is("ios") ? "heart-outline" : null,
handler: () => {
console.log("Favorite clicked");
}
},
{
text: "Cancel",
role: "cancel", // will always sort to be on the bottom
icon: !this.platform.is("ios") ? "close" : null,
handler: () => {
console.log("Cancel clicked");
}
}
]
});
actionSheet.present();
}
示例8: blurActiveInput
blurActiveInput() {
if (!this.platform.is("iOS")) return;
var activeElement:any = document.activeElement;
if(activeElement.tagName == "INPUT" || activeElement.tagName == "TEXTAREA") {
activeElement.blur();
}
}
示例9: actuallyShow
private actuallyShow(text) {
if (this.platform.is('cordova')) {
Toast.show(text, '1500', 'bottom').subscribe();
}
else {
console.log(`Toast: ${text}`);
}
}
示例10: createEditButton
createEditButton(message, handler) {
return {
text: this.translate.instant(message),
icon: !this.platform.is('ios') ? 'create' : null,
cssClass: 'WorkoutAction-edit',
handler
}
}