本文整理汇总了TypeScript中connectivity.startMonitoring函数的典型用法代码示例。如果您正苦于以下问题:TypeScript startMonitoring函数的具体用法?TypeScript startMonitoring怎么用?TypeScript startMonitoring使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了startMonitoring函数的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的TypeScript代码示例。
示例1: switch
return Observable.create((observer) => {
connectivity.startMonitoring((newConnectionType: number) => {
switch (newConnectionType) {
case connectivity.connectionType.none:
this.connectionType = "None";
observer.next('Connection type changed to none.');
break;
case connectivity.connectionType.wifi:
this.connectionType = "Wi-Fi";
observer.next('Connection type changed to WiFi.');
break;
case connectivity.connectionType.mobile:
this.connectionType = "Mobile";
observer.next('Connection type changed to mobile.');
break;
default:
break;
}
});
});
开发者ID:sandy100,项目名称:Coursera,代码行数:21,代码来源:platform.service.ts
示例2: ngOnInit
ngOnInit() {
// >> connectivity-start-code
connectivity.startMonitoring((newConnectionType: number) => {
switch (newConnectionType) {
case connectivity.connectionType.none:
this.connectionType = "None";
console.log("Connection type changed to none.");
break;
case connectivity.connectionType.wifi:
this.connectionType = "Wi-Fi";
console.log("Connection type changed to WiFi.");
break;
case connectivity.connectionType.mobile:
this.connectionType = "Mobile";
console.log("Connection type changed to mobile.");
break;
default:
break;
}
});
// << connectivity-start-code
}
开发者ID:KingAndroid,项目名称:nativescript-sdk-examples-ng,代码行数:22,代码来源:using-connectivity.component.ts
示例3: startMonitoring
startMonitoring(callback: { (connectionType: ConnectionType) }) {
return startMonitoring(callback);
}
开发者ID:TheOriginalJosh,项目名称:nativescript-weather,代码行数:3,代码来源:connection.service.ts
注:本文中的connectivity.startMonitoring函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论