how can I access DataEngines from JavaScript in the Web Plasmoids?

Patrick Aljord patcito at gmail.com
Tue Jan 5 00:54:53 CET 2010


On Mon, Jan 4, 2010 at 6:10 PM, Aaron J. Seigo <aseigo at kde.org> wrote:
>
> relative to what we're doing, it is. i somehow doubt it will work at all with
> remote widgets, for instance.

Ok I didn't think about remote widgets. Point taken.

>
> in particular, it's pretty evident that html5 storage has been designed for
> use in web browsers. it's really that specific. because we don't use html
> anywhere else, right? *sigh* the people looking after the web standards are
> truly myopic.

I just assumed that the web plasmoid was done to write browser or web
apps in plasmoids.

>
> but if the world goes "all in" on the web technology
> boat 100% we will be in a world of pain as time goes on.

I don't think so, stuff like canvas, web sockets, fast js engines,
webgl or even native client will turn the browser into a powerful
platform not only for traditional web apps but I guess time will tell.

> thoughts/ideas/improvements/refinements?


I like your version with no namespace pollution better:

> var storage = new Storage
> storage.document = noteId()
> storage.store("text", noteText())

Interestingly, the couchdb guys wrote an API on top of html5 storage
to turn it into a key value store, it looks like this in JS:

var jsondb = new JSONDB("dbname");

jsondb["some_key"] = {"some":"json"};

jsondb.forEach(function(key, value) {
  // in order traversal
});

jsondb.forEach(function(key, value) {
  // reverse order traversal
}, {
  "descending":true
});

jsondb.forEach(function(key, value) {
  // inorder traversal,
  // starting from "startkey",
  // ending with "endkey"
  // you can use throw() to stop traversal
},{
  "startkey":"a",
  "endkey":"z"
});

jsondb.forEach(function(key, value) {
  // reverse order traversal, starting from "startkey"
  // you can use throw() to stop traversal
},{
  "startkey":"z",
  "descending":true
});

// delete a btree
JSONDB.drop("dbname");

http://github.com/jchris/WebWorkerStorage/blob/ba716338d2627377fb1369193d7bf5dcf96b7ddd/JSONDB.md


More information about the Plasma-devel mailing list