Ok,

This is what I have done so far, please let me know if it is correc:


   1.  I added pouch-db as a library module
   2. I have created an startup module that looks like this
   (function(){
   
   /*jslint node: true, browser: true */
   /*global $tw: false */
   "use strict";
   
   // Export name and synchronous status
   exports.name = "pouchdb";
   exports.after = ["startup"];
   exports.synchronous = true;
   
   exports.startup = function() {
       var PouchDB = 
   require("$:/plugins/danielo515/tiddlypouch/pouchdb.js");
       $tw.database = new PouchDB('tiddlywiki');
   };
   
   })();
   

I'm thinking about limiting it to browser scope. I know that pouchdb can 
work both on browser and node, but I'm not sure how to handle this at node 
side, and how should the plugin behave. Maybe to create two pouch databases 
(server side and client side) and sync between them?

El lunes, 25 de mayo de 2015, 8:59:44 (UTC+2), Danielo Rodríguez escribió:
>
> Hello everyone,
>
> As usual, I want to create a new plugin, but I have some lack of knowledge 
> at certain areas. This one is about where is the best place to instantiate 
> the database object that has to be used. As you probably know, pouchdb is a 
> javascript database you can talk to, but you have to do it through an 
> object. Where is the best place to instantiate that object? Note that you 
> only have to create it once, and talk to it on subsequent save/load 
> operations. I though about creating it in the part of the adapter where it 
> is instantiated, but I'm not sure about this.
>
> Thanks for any hint.
>

-- 
You received this message because you are subscribed to the Google Groups 
"TiddlyWikiDev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/tiddlywikidev.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/tiddlywikidev/1ef7b7c4-0693-4682-a3f1-0f2dfa8198d4%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to