Is anyone using anki-persistence with key-value pairs?

The key has to be a string, this should work for example:

Front

var rand1 = Math.random();
var rand2 = Math.random();

Persistence.setItem("rand1", rand1);
Persistence.setItem("rand2", rand2);

/* Do something with these numbers ... */

Back

var rand1 = Persistence.getItem("rand1");
var rand2 = Persistence.getItem("rand2");

/* Do same thing with these numbers ... */
5 Likes