Thanks you very much for the reply. The int
option looks better and simpler.
Faced with the following problem. The API code inside the _JS StorageGet
function is executed asynchronously and fineshed after calling return value
, i.e. _JS Storage Get
returns an empty value.
How can I wait for the value to be received in the example, or any other solution?
_JSStorageGet: function (keyPtr, fallbackValue) {
// you first need to actually read them out!
var keyString = UTF8ToString(keyPtr);
// Deal with api
myBridge.send("StorageGet", {"keys": [keyString]}).then(data => {
if (data.keys[0].value) {
console.log(JSON.parse(data.keys[0].value));
var value = JSON.parse(data.keys[0].value);
return value ; // return too early, when value is not ready yet
} else
return fallbackValue;
}