treojs / treo

Consistent API to IndexedDB

Home Page:http://treojs.com

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

I couldn't worked it out with PhoneGap for my project

erhanyasar opened this issue · comments

basically I added 3 .js treo files in the dist directory into my js/vendor/shim as below,

screen shot 2016-08-18 at 21 26 44

but it returns me the error below that 'schema' not defined. How can I surpass this?

screen shot 2016-08-18 at 21 36 06

Many thanks in advance..

@erhanyasar you need to define the schema for your database - take a look at the example in the README https://github.com/treojs/treo#example

var treo = window.treo

// define db schema
var schema = treo.schema()
  .version(1)
    .addStore('books', { key: 'isbn' })
    .addIndex('byTitle', 'title', { unique: true })
    .addIndex('byAuthor', 'author')
  .version(2)
    .getStore('books')
    .addIndex('byYear', 'year')
  .version(3)
    .addStore('magazines')
    .addIndex('byPublisher', 'publisher')
    .addIndex('byFrequency', 'frequency');

// open db
var db = treo('library', schema);

Actually I have doubts how to implement the above code to my project. I'll need some advise I guess, it will not be a solely solution to copy it to my project @unkillbob

@erhanyasar perhaps you need an introduction to IndexedDB? I did an introductory presentation on IndexedDB and treo a couple of years ago, here's my slide deck https://unkillbob.github.io/indexeddb-treo-presentation/ - its probably not much help without the corresponding presentation but hopefully it helps a little. If not perhaps see if you can find a decent blog post or online course on IndexedDB.

Tx for your time and real friendly hand, I'm digging into IndexedDB with a couple of source hence your link is just opens and stay with the screen below fyi. Have a nice day!

screen shot 2016-08-22 at 09 48 38

your link is just opens and stay with the screen below fyi

Oh sorry I should have explained, you can navigate the presentation with the left & right arrow keys!

@unkillbob hello again, it's been months and I'm still searching for it; hence not found a solution yet. Issued same with IndexedDBShim/issues/#260 so that waiting for a clue.