clear fetch pool when click cancel

This commit is contained in:
Gabe Yuan
2023-08-11 16:48:09 +08:00
parent e5185150f8
commit 72785f2fca
5 changed files with 39 additions and 9 deletions

View File

@@ -2,6 +2,7 @@ import browser from "webextension-polyfill";
import {
MSG_FETCH,
MSG_FETCH_LIMIT,
MSG_FETCH_CLEAR,
DEFAULT_SETTING,
DEFAULT_RULES,
DEFAULT_SYNC,
@@ -62,6 +63,10 @@ browser.runtime.onMessage.addListener(
fetchPool.update(interval, limit);
sendResponse({ data: "ok" });
break;
case MSG_FETCH_CLEAR:
fetchPool.clear();
sendResponse({ data: "ok" });
break;
default:
sendResponse({ error: `message action is unavailable: ${action}` });
}