Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function Label(name, color) {
- this.name = name;
- this.color = color;
- }
- var workLabel = new Label('work', 'red');
- var personalLabel = new Label('personal', 'red');
- console.log(workLabel instanceof Label)
- localforage.setItem(uuidv4(), workLabel).then(function (workLabel) {
- console.log(workLabel);
- }).catch(function (err) {
- console.log(err);
- })
- localforage.setItem(uuidv4(), personalLabel).then(function (personalLabel) {
- console.log(personalLabel);
- }).catch(function (err) {
- console.log(err);
- })
- localforage.iterate(function(value, key, iterationNumber) {
- // Resulting key/value pair -- this callback
- // will be executed for every item in the
- // database.
- if (value instanceof Label) {
- console.log("teste");
- console.log([key, value]);
- }
- }).then(function() {
- console.log('Iteration has completed');
- }).catch(function(err) {
- // This code runs if there were any errors
- console.log(err);
- });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement