Beginner developer question


Figure 1

Figure 2

Figure 3

The code from figure 1 is working fine.
However, running of the figure 2 highlighted parts of code come out with the error shown as figure 3. Why is it possible to reuse the “mdata” in figure 1 but failed in figure 2. Can anyone tell me about the problem?


If I’ve got it right, the first example is properly handling the asynchronous nature of these operations. is called correctly in the then block after the value is returned by window.safeMutableData.get...

In the second example, is synchronously called before window.safeMutableData.quickSetup... completes it’s operation.

Without seeing the full source I can’t know exactly, but I think that’s what’s happening.