mirror of
https://github.com/bitwarden/browser.git
synced 2024-09-18 02:41:15 +02: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.
|
* @param alarmName - The name of the alarm to create.
|
||||||
*/
|
*/
|
||||||
static clearAlarm(alarmName: string): Promise<boolean> {
|
static clearAlarm(alarmName: string): Promise<boolean> {
|
||||||
if (typeof browser?.alarms !== "undefined") {
|
if (typeof browser !== "undefined" && browser.alarms) {
|
||||||
return browser.alarms.clear(alarmName);
|
return browser.alarms.clear(alarmName);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -611,7 +611,7 @@ export class BrowserApi {
|
|||||||
* that indicates when all alarms have been cleared successfully.
|
* that indicates when all alarms have been cleared successfully.
|
||||||
*/
|
*/
|
||||||
static clearAllAlarms(): Promise<boolean> {
|
static clearAllAlarms(): Promise<boolean> {
|
||||||
if (typeof browser?.alarms !== "undefined") {
|
if (typeof browser !== "undefined" && browser.alarms) {
|
||||||
return browser.alarms.clearAll();
|
return browser.alarms.clearAll();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -625,7 +625,7 @@ export class BrowserApi {
|
|||||||
* @param createInfo - The creation info for the alarm.
|
* @param createInfo - The creation info for the alarm.
|
||||||
*/
|
*/
|
||||||
static async createAlarm(name: string, createInfo: chrome.alarms.AlarmCreateInfo): Promise<void> {
|
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);
|
return browser.alarms.create(name, createInfo);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -638,7 +638,7 @@ export class BrowserApi {
|
|||||||
* @param alarmName - The name of the alarm to get.
|
* @param alarmName - The name of the alarm to get.
|
||||||
*/
|
*/
|
||||||
static getAlarm(alarmName: string): Promise<chrome.alarms.Alarm> {
|
static getAlarm(alarmName: string): Promise<chrome.alarms.Alarm> {
|
||||||
if (typeof browser?.alarms !== "undefined") {
|
if (typeof browser !== "undefined" && browser.alarms) {
|
||||||
return browser.alarms.get(alarmName);
|
return browser.alarms.get(alarmName);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -649,7 +649,7 @@ export class BrowserApi {
|
|||||||
* Gets all alarms that have been set by the extension.
|
* Gets all alarms that have been set by the extension.
|
||||||
*/
|
*/
|
||||||
static getAllAlarms(): Promise<chrome.alarms.Alarm[]> {
|
static getAllAlarms(): Promise<chrome.alarms.Alarm[]> {
|
||||||
if (typeof browser?.alarms !== "undefined") {
|
if (typeof browser !== "undefined" && browser.alarms) {
|
||||||
return browser.alarms.getAll();
|
return browser.alarms.getAll();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user