Files
binaural-beats-generator/background.js
2023-08-12 22:37:09 +00:00

19 lines
508 B
JavaScript

chrome.runtime.onInstalled.addListener(() => {
chrome.storage.sync.set({frequency: '440'});
});
chrome.tabs.onUpdated.addListener((tabId, changeInfo, tab) => {
if (changeInfo.status === 'complete' && /^http/.test(tab.url)) {
chrome.scripting.executeScript({
target: {tabId: tabId},
files: ['binauralGenerator.js']
});
}
});
chrome.action.onClicked.addListener((tab) => {
chrome.scripting.executeScript({
target: {tabId: tab.id},
files: ['binauralGenerator.js']
});
});