Skip to content

Commit

Permalink
fix(core): 添加本地存储初始化时删除无用字段
Browse files Browse the repository at this point in the history
  • Loading branch information
enncy committed Mar 12, 2023
1 parent c56b54f commit dc57a4a
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions packages/core/src/interfaces/store.provider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,17 @@ export class ObjectStoreProvider implements StoreProvider {
* 油猴存储器
*/
export class GMStoreProvider implements StoreProvider {
constructor() {
// 当页面首次加载时删除之前的监听数据
if (self === top) {
for (const val of GM_listValues()) {
if (val.startsWith('_tab_change_')) {
GM_deleteValue(val);
}
}
}
}

/** 获取本地能够触发 tab 监听的key */
getTabChangeHandleKey(tabUid: string, key: string) {
return `_tab_change_${tabUid}_${key}`;
Expand Down

0 comments on commit dc57a4a

Please sign in to comment.