Skip to content

Commit 169289b

Browse files
committed
chore: set default refresh alarm to 5 minutes
1 parent b165daf commit 169289b

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

src/background/index.ts

+9-2
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import type { IAlertSetting, IAlertStatus, IRoleDataItem, IUserData, IUserDataIt
55
import { createVerification, getRoleDataByCookie, getRoleInfoByCookie, verifyVerification } from '~/utils'
66

77
// 一分钟
8-
const INTERVAL_TIME = 3
8+
const INTERVAL_TIME = 5
99

1010
// 角色的默认提醒设定
1111
const defaultAlertSetting: IAlertSetting = {
@@ -482,7 +482,14 @@ const refreshData = async function (uiOnly = false) {
482482
}
483483

484484
// 定时器,定时获取玩家数据
485-
alarms.create('refresh_data', { periodInMinutes: INTERVAL_TIME })
485+
486+
const initAlarm = async (interval_time = INTERVAL_TIME) => {
487+
await alarms.clear('refresh_data')
488+
alarms.create('refresh_data', { periodInMinutes: interval_time })
489+
}
490+
491+
initAlarm()
492+
486493
alarms.onAlarm.addListener((alarmInfo) => {
487494
if (alarmInfo.name === 'refresh_data')
488495
refreshData()

0 commit comments

Comments
 (0)