declare var window: { cordova: { exec: Function } } /** * This is a simple helper to Promisify the calls to cordova * * @param {string} command The native cordova implementation command * @param {unknown[]} args The native cordova implementation expected arguments * * @returns {Promise} Returns from the async native call the type expected */ export const execAsPromise = (command: string, args: unknown[] = []): Promise => new Promise( (resolve: (value: R | PromiseLike) => void, reject: (reason?: any) => void) => { window.cordova.exec(resolve, reject, 'FCMPlugin', command, args) } )