You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Typically I would only call db = new PouchDB and db.sync once and pass it down to components/modules or similar; whether in browser or Node.
But I'm testing out using pouch with modul-arly loaded JavaScript in the browser.
E.g. Only script for the components loaded on screen will have associated script loaded for them.
So I'm trying avoid relying on loading and running one "main" JS file, that instantiates pouch, as it may fail to load (in time) for the other files to have access.
However, I'm afraid of the overhead or risks on calling "db = new PouchDB" etc in each component. I think/know pouch itself will handle it as if the DB exists it will just create another instance (but not a new database); assigning it to said var. I think sync will fall back as well.
It seems crazy to keep instantiating pouch but is it?
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
Typically I would only call
db = new PouchDB
anddb.sync
once and pass it down to components/modules or similar; whether in browser or Node.But I'm testing out using pouch with modul-arly loaded JavaScript in the browser.
E.g. Only script for the components loaded on screen will have associated script loaded for them.
So I'm trying avoid relying on loading and running one "main" JS file, that instantiates pouch, as it may fail to load (in time) for the other files to have access.
However, I'm afraid of the overhead or risks on calling "db = new PouchDB" etc in each component. I think/know pouch itself will handle it as if the DB exists it will just create another instance (but not a new database); assigning it to said var. I think sync will fall back as well.
It seems crazy to keep instantiating pouch but is it?
Beta Was this translation helpful? Give feedback.
All reactions