mirror of
https://github.com/bitwarden/browser.git
synced 2025-02-24 02:41:54 +01:00
[PM-6426] Fixing how we check for the browser alarms api
This commit is contained in:
parent
428937d1a8
commit
dbbc07b08b
@ -599,7 +599,7 @@ export class BrowserApi {
|
||||
* @param alarmName - The name of the alarm to create.
|
||||
*/
|
||||
static clearAlarm(alarmName: string): Promise<boolean> {
|
||||
if (typeof browser?.alarms !== "undefined") {
|
||||
if (typeof browser !== "undefined" && browser.alarms) {
|
||||
return browser.alarms.clear(alarmName);
|
||||
}
|
||||
|
||||
@ -611,7 +611,7 @@ export class BrowserApi {
|
||||
* that indicates when all alarms have been cleared successfully.
|
||||
*/
|
||||
static clearAllAlarms(): Promise<boolean> {
|
||||
if (typeof browser?.alarms !== "undefined") {
|
||||
if (typeof browser !== "undefined" && browser.alarms) {
|
||||
return browser.alarms.clearAll();
|
||||
}
|
||||
|
||||
@ -625,7 +625,7 @@ export class BrowserApi {
|
||||
* @param createInfo - The creation info for the alarm.
|
||||
*/
|
||||
static async createAlarm(name: string, createInfo: chrome.alarms.AlarmCreateInfo): Promise<void> {
|
||||
if (typeof browser?.alarms !== "undefined") {
|
||||
if (typeof browser !== "undefined" && browser.alarms) {
|
||||
return browser.alarms.create(name, createInfo);
|
||||
}
|
||||
|
||||
@ -638,7 +638,7 @@ export class BrowserApi {
|
||||
* @param alarmName - The name of the alarm to get.
|
||||
*/
|
||||
static getAlarm(alarmName: string): Promise<chrome.alarms.Alarm> {
|
||||
if (typeof browser?.alarms !== "undefined") {
|
||||
if (typeof browser !== "undefined" && browser.alarms) {
|
||||
return browser.alarms.get(alarmName);
|
||||
}
|
||||
|
||||
@ -649,7 +649,7 @@ export class BrowserApi {
|
||||
* Gets all alarms that have been set by the extension.
|
||||
*/
|
||||
static getAllAlarms(): Promise<chrome.alarms.Alarm[]> {
|
||||
if (typeof browser?.alarms !== "undefined") {
|
||||
if (typeof browser !== "undefined" && browser.alarms) {
|
||||
return browser.alarms.getAll();
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user