MCPcopy Index your code
hub / github.com/ClearURLs/Addon / increaseBadged

Function increaseBadged

core_js/badgedHandler.js:29–57  ·  view source on GitHub ↗

* Increases the badged by one.

(quiet = false, request)

Source from the content-addressed store, hash-verified

27 * Increases the badged by one.
28 */
29function increaseBadged(quiet = false, request) {
30 if (!quiet) increaseCleanedCounter();
31
32 if(request === null) return;
33
34 const tabId = request.tabId;
35 const url = request.url;
36
37 if(tabId === -1) return;
38
39 if (badges[tabId] == null) {
40 badges[tabId] = {
41 counter: 1,
42 lastURL: url
43 };
44 } else {
45 badges[tabId].counter += 1;
46 }
47
48 checkOSAndroid().then((res) => {
49 if (!res) {
50 if (storage.badgedStatus && !quiet) {
51 browser.browserAction.setBadgeText({text: (badges[tabId]).counter.toString(), tabId: tabId}).catch(handleError);
52 } else {
53 browser.browserAction.setBadgeText({text: "", tabId: tabId}).catch(handleError);
54 }
55 }
56 });
57}
58
59/**
60 * Call by each tab is updated.

Callers 2

removeFieldsFormURLFunction · 0.85
clearUrlFunction · 0.85

Calls 3

increaseCleanedCounterFunction · 0.85
checkOSAndroidFunction · 0.85
toStringMethod · 0.80

Tested by

no test coverage detected