._backup - macmcmeans/localDataStorage GitHub Wiki
localDataStorage._backup( keyName, [overwriteExistingKey] )
This Memory Key method effectively moves the value of keyName, a Memory Key, into localStorage, creating a new key if necessary. This is the way to back up memory to disk.
The data type is of course respected.
This will overwrite an existing value for keyName when the optional overwriteExistingKey is true (and throw an error when it is not). If this happens, the prior value cannot be retrieved.
The operation verifies the destination localStorage key has been written. Once verified, the Memory Key is deleted.
EXAMPLE:
● localData._backup( 'key1' )
✨ The complement to this is _restore.
📝 NOTE: Once a session using Memory Keys has concluded, back up the required keys to disk using this method.