本文整理匯總了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
}
}