首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >将角度转换为平面JavaScript

将角度转换为平面JavaScript
EN

Stack Overflow用户
提问于 2022-09-11 17:20:40
回答 1查看 47关注 0票数 -2

这是离子/电容器/角项目插件的示例代码:

代码语言:javascript
复制
import { ForegroundService } from '@awesome-cordova-plugins/foreground-service/ngx';


constructor(public foregroundService: ForegroundService) { }

...

startService() {
// Notification importance is optional, the default is 1 - Low (no sound or vibration)
  this.foregroundService.start ('GPS Running', 'Background Service', 'drawable/fsicon');
}

stopService() {
// Disable the foreground service
  this.foregroundService.stop();
}

我不熟悉棱角,也没有普通的JavaScript (不是打字稿)的例子。在普通的JavaScript中,这些代码看起来如何?

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2022-09-11 17:33:12

我不是一个离子专家,但在阅读了医生们之后,我打赌它应该像这样使用:

代码语言:javascript
复制
// import without `ngx`
import { ForegroundService } from '@awesome-cordova-plugins/foreground-service';

// create the object from class
const foregroundService = new ForegroundService();

// start the service
foregroundService.start('GPS Running', 'Background Service', 'drawable/fsicon');

// stop the service
foregroundService.stop()

了解有关在React中使用离子本机组件的更多信息部分特别有用

票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/73681242

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档