Closed elmatou closed 4 years ago
Looking at the code I see that $pouch
is instantiated in each component as a mixin.
It do not look like it is very useful, maybe I can try to instantiate it as a "Vuejs Instance Properties".
By this the object would be set one a for all and not in each component (reducing memory load, events, ...)
@assemblethis @MDSLKTR, would anybody mind if I try a PR on this matter?
I found the culprit !
there is no use to create the database upon component creation. it is checked in every methods: https://github.com/MDSLKTR/pouch-vue/blob/9637b04655f91330693b5c854c256c642e5aba55/src/index.js#L143-L145
Since i don't use or maintain this library anymore, feel free to change things for the better. Any PRs can be merged. This library started as a proof of concept so there are flaws for sure.
To be honest, With no news, I figured out, that despite the warning in the README, this project is a bit stalled.
So, I started my fork, for my own purpose : https://github.com/elmatou/vue-pouchdb-lite
No worries, this is certainly true
Looking at the code I see that
$pouch
is instantiated in each component as a mixin. It do not look like it is very useful, maybe I can try to instantiate it as a "Vuejs Instance Properties". By this the object would be set one a for all and not in each component (reducing memory load, events, ...)@assemblethis @MDSLKTR, would anybody mind if I try a PR on this matter?
You could try using pouch-vue as an event bus which is what the Boatnet project does: https://github.com/nwfsc-fram/boatnet-module/blob/master/bn-pouch/src/_services/pouch.service.ts
A new Vue instance is instantiated in the last line: export const pouchService = new PouchService();
Then they attach listeners to a Vuex store where state is kept: https://github.com/nwfsc-fram/boatnet-module/blob/master/bn-pouch/src/_store/pouch.module.ts
It's one way of doing it.
@assemblethis Can you comment on the difference between your proposal and @elmatou's fork at: https://github.com/elmatou/vue-pouchdb-lite?
Not really a bug, not really a feature.
Using pouch-vue ase a Vue plugin, it instantiates on every components render. In vue-dev-tool it look like this :
That is only part of the dump, here is the typical event.
It seems a but to much of events triggered, and maybe to much of db created. Can't we make leverage of provide / inject ?
https://vuejs.org/v2/api/#provide-inject