UNPKG

cordova-plugin-background-service-android

Version:
26 lines (20 loc) 827 B
var exec = require('cordova/exec'); // exports.coolMethod = function (arg0, success, error) { // exec(success, error, 'BackgroundService', 'coolMethod', [arg0]); // }; function BackgroundService() { console.log("BackgroundService.js: is created"); } BackgroundService.prototype.echo = function (arg0, success, error) { exec(success, error, 'BackgroundService', 'echo', [arg0]); }; BackgroundService.prototype.getCallback = function (callback, success, error) { BackgroundService.prototype.callbackResult = callback; exec(success, error, "BackgroundService", 'callback', []); } // CALLBACK RESULT// BackgroundService.prototype.callbackResult = (payload) => { console.log("Received callbackResult => ", payload); } var backgroundService = new BackgroundService(); module.exports = backgroundService;