noovil / chrome-extension-manifestv3

11 stars 3 forks source link

Can we access firebase api in service worker? #2

Open pranvendra opened 2 years ago

pranvendra commented 2 years ago

Hi @noovil, Thanks for your solution of connecting to firebase in mv3 I want to know if I can access these apis in service worker, since I want to send data to firebase based on some vent listeners.

Please help me out here

noovil commented 2 years ago

@pranvendra You can import the bundle.js script into your service worker by using chrome.scripting

DevProjctX commented 2 years ago

Thank you for your response @noovil and it works when i am trying to write in firestore

I hv additional question -

I am writing my firestore 'write' func in index.js with couple of user parameters ( like userid, tab info )

is there a way i can pass these arguments to index.js from service worker?

noovil commented 2 years ago

I think so, try declaring those parameters as a global variable in the service worker and load bundle.js after