Get tab id in side panel for both Chrome and Firefox?

I've been getting the tab id by running this code in the side panel when it's loaded:
const tabIdRes = await chrome.tabs.query({
  active: true,
  currentWindow: true
});


This works for Chrome but I also need to support Firefox. This works on Firefox:
await browser.tabs.query


AI suggested I create this pollyfil, which I think would work. However is there a solution built into Plasmo?
if (typeof browser === "undefined") {
  var browser = chrome;
}

export default browser;
Was this page helpful?