import { browser } from "webextension-polyfill-ts";

// Listen for messages sent from other parts of the extension
browser.runtime.onMessage.addListener((request: { popupMounted: boolean }) => {
    // Log statement if request.popupMounted is true
    // NOTE: this request is sent in `popup/component.tsx`
    if (request.popupMounted) {
        console.log("backgroundPage notified that Popup.tsx has mounted.");
    }
});

browser.runtime.onInstalled.addListener(function (details) {
    console.log('INSTALLED');
    if ((details.reason === 'install') && (process.env.NODE_ENV === 'production')) {
        browser.tabs.create({url: 'whiterabbit.one'});
    }
})