0

linq2IndexedDB in windows8 winJS

Hi i am working on a winJS application.I am using linq2IndexedDB for connection IndexedDb with winJS.I am creating a database in one javascript page.How can create an object for indexedDb in other pages?

2 Answers2

0

if the variable is kept outside any function in any page, it is global and available in all pages. so one possibility is to do this.

var indexdbObj; // it will be available in all other pages
(function() {
   ....
   function xyz()
   {
       indexdbObj = new IndexDB();
   }
})();

other recommended way to use WinJS.Namespace.define() method.

var indexdb = new IndexDB();
WinJS.Namespace.define('Database', 
    {
        client: indexdb
    });

at all places including other pages, Database.client.methodOnIndexDB() can be used to invoke a method on indexDB object.

Sushil
  • 5,265
  • 2
  • 17
  • 15
0

Just the same as you do for the others. var l2i = new window.linq2indexeddb(...);

This will allow you to work in de same indexeddb. The linq2indexeddb only provides a coonection to the db for you.

greetings

kristof

Kristof Degrave
  • 4,142
  • 22
  • 32