79386615

Date: 2025-01-25 11:26:38
Score: 3.5
Natty:
Report link

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;
  }
Reasons:
  • Blacklisted phrase (0.5): Thanks
  • Blacklisted phrase (0.5): How can I
  • Long answer (-0.5):
  • Has code block (-0.5):
  • Ends in question mark (2):
  • Self-answer (0.5):
  • Low reputation (1):
Posted by: Марк