NodeStore.saveJsonToStorage()

Save a key-value pair in string format to the persistent data store. This is compatible with PhoneGap/Cordova

This machinepack provides an easy-to-use key/value pair-based database using the HTML5 localStorage model. With some HTTP requests you should be able to effectively use this as a replacement for cookies on PhoneGap/Cordova-based apps.

Usage

Hover over inputs/exits for more info.

var NodeStore = require('machinepack-nodestore');


// Save a key-value pair in string format to the persistent data store. This is compatible with PhoneGap/Cordova

NodeStore.saveJsonToStorage({

key: 'user',

value: '*',

}).exec({

// An unexpected error occurred.

error: function (err) {

 

},

// OK.

success: function (result) {

 

},

});

Inputs

key required

The name of the key you wish to save to the unique session.

'user'
value required

The value of the key you wish to save to the datastore. Only supports JSON-formatted strings or objects.

Exits

error

An unexpected error occurred.

success

OK.

{ friendlyName: 'then',
  desription: 'Successfully saved data to the persistent datastore.' }