Files
SubMusic/source/Store/Store.mc
memen45 ef1fbed7ac speed improvements
- updated Ampache5 Error codes (backwards compatible)
- improved speed in Song access during play
- fixed removal of removed songs (now performed after complete sync)
- fixed issue on trying to sync artwork with id null
2021-10-15 13:05:19 +02:00

38 lines
785 B
MonkeyC

using Toybox.Application;
using Toybox.System;
class Store {
private var d_key; // key to set/retrieve the stored data
private var d_value = null; // variable that is reflected in the Application.Storage
function initialize(key, value) {
System.println("Store::initialize( key: " + key + " value: " + value + " )");
d_key = key;
var stored = Application.Storage.getValue(d_key);
if (stored != null) {
d_value = stored;
return;
}
d_value = value;
}
function value() {
return d_value;
}
function setValue(value) {
d_value = value;
}
function update() {
var success = true;
try {
Application.Storage.setValue(d_key, d_value);
} catch (exception instanceof Toybox.Lang.StorageFullException) {
success = false;
}
return success;
}
}