17 lines
398 B
JavaScript
17 lines
398 B
JavaScript
"use strict"
|
|
|
|
function setBadgeText(enabled) {
|
|
const text = enabled ? "ON" : "OFF"
|
|
void chrome.action.setBadgeText({text: text})
|
|
}
|
|
|
|
function startUp() {
|
|
chrome.storage.sync.get("enabled", (data) => {
|
|
setBadgeText(!!data.enabled)
|
|
})
|
|
}
|
|
|
|
// Ensure the background script always runs.
|
|
chrome.runtime.onStartup.addListener(startUp)
|
|
chrome.runtime.onInstalled.addListener(startUp)
|