Here is an example code snippet for a plugin used in an Ionic/Capacitor/Angular project:
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();
}
I don't have experience with Angular, and I am searching for an example that uses plain JavaScript (not Typescript). How would you rewrite this code in plain JavaScript?