ehsan shirzadi
ehsan shirzadi

Reputation: 4859

How to manage large java script data files?

I'm developing a Cordova project. to store my data I'm using java script files like this:

var groups = [
    {
        id: 1,
        parent_id: 0,
        name: "Group 1"
    },
    {
        id: 2,
        parent_id: 0,
        name: "Group 2"
    }
];

First problem is that I don't know if it is a good way or maybe there are better ways.
to use this data, simply I use a loop through variable, but the problem is when there are large data volumes, for example thousands of records. It's hard to handle this amount of data in a .js file. what should I do?

Upvotes: 0

Views: 114

Answers (1)

Adi
Adi

Reputation: 6374

A possible solution is to use a database such as IndexedDB(if your app is completely offline) or FireBase (if your app uses internet), you can query and get just the data you require.

Even DOM Storage (Local-Storage) is an option but there is the problem of looping over an array and this cannot store more than 5MB of data.

Upvotes: 1

Related Questions