Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

"In-Memory" in persistence.js not working #198

Open
carper7 opened this issue Feb 17, 2021 · 0 comments
Open

"In-Memory" in persistence.js not working #198

carper7 opened this issue Feb 17, 2021 · 0 comments

Comments

@carper7
Copy link

carper7 commented Feb 17, 2021

Hi,

I am looking for a tool that will allow me to store data in local storage and came across persistence.js. I am looking at being able to store the data, create a dump and then restore it to keep working on the same. Based on the github page this plugin allows to do that and more but I am having hard time making it work. I just played with the examples in the github but nothing is created and also get errors when dumping/restoring data. This is what I have so far:

persistence.schemaSync();
var Item = persistence.define('Item', {
ItemId: "TEXT",
Name: "TEXT"
});

var item = new Item();
item.ItemId = "124";
item.Name = "Test1";

persistence.add(item);
persistence.flush( );

persistence.dump(tx, [Item], function(dump) {
console.log(dump);
});

persistence.load(tx, dump, function() {
alert('Dump restored!');
});

Could you please help me out. I would like to store some data in a json file, save it in local storage, create a dump of that json file, and finally restore it in order to keep adding more to it at a later time. These are the libraries I am using in my html file:

<script src='persistencejs/lib/persistence.js'></script>
<script src='persistencejs/lib/persistence.store.memory.js'></script>

<script src='persistencejs/lib/persistence.store.sql.js'></script> <script src='persistencejs/lib/persistence.store.websql.js'></script>

Kind Regards,

C.Peretz

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant