Question

I've been using jaydata with TypeScript against an OData store as described here: http://jaystack.com/blog/typescript-meets-odata-with-the-help-of-jaydata-and-jaysvcutil.

Now, I'm trying to extend the application to use a local store as well (say, webSql) but it appears the typescript declaration file only allows for an OData context to be instantiated. How can I use the declaration file while targeting a different storage provider?

Was it helpful?

Solution

I work for JayData. Sorry for the late reply. In JayData we have a "virtual" provider called 'local'. It hides the different local storage technologies the different browsers support, so you don't have to worry about it and write code for IndexedDB, WebSQL and HTML5.localStorage. Just write it once and it will work.

All you have to do is to change the parameters of the service, like this:

var mydatabaseService = new mydatabase.mydatabaseService({
    name: 'local',
    databaseName: 'myitems'
});

There are a few things to be careful about: -string primary keys are not supported (not by JayData but by the stores) -if you want navigation properties then currently it is only supported by sqLite so you must use it explicit (name: 'sqLite' instead of name: 'local') and sqlite can not be found in every device. We will implement navigation in other stores soon.

OTHER TIPS

At the risk of stating the obvious: you could create your own d.ts declaration file, or edit the one you have been using, or see if there is one here: https://github.com/borisyankov/DefinitelyTyped

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top