Assigning value from getKeyValue to a variable

I’ve been trying to assign a value retrieved by the getKeyValue function to a variable that can be used outside of that funciton. However, nothing seems to work. Any suggestions?

Without the example code in front of me there is one thing that comes to mind. You don’t know when that variable will be assigned. There is no guarantee that the callback function will execute in a timely fashion.

Please share a link to your code.

Based on the previous reply, I got it to work. A 1-s timeout for getKeyValue to complete made it work. Is there a better way to accomplish this?

1 Like

You need to create functions for each step in the process. Call those functions from the callbacks. Chain them together so they only get called when they are ready.


Thanks, that’s better and faster.