Home > Mobile >  Turn to post about wx. CanvasToTempFilePath asynchronous synchronization problem
Turn to post about wx. CanvasToTempFilePath asynchronous synchronization problem

Time:09-17

The younger brother were taken to achieve the user each photograph to be able to add watermark and then uploaded to the server through the canvas, normal process should be:
Foreach (item, index)
{
1. Through the canvas load photo background and watermark
2. Will the canvas to generate images, which in turn generate local address
CTX. The draw (true, async ()=& gt; {
Const res1=await wx. CanvasToTempFilePath ({
CanvasId: "firstCanvas"}); }...
3. Upload images,,,,
}
My order is 132, however, this leads to a local address is actually a null value when I upload, because to 3, 2 of the asynchronous operation has not returned,


Baidu's a lot of methods, on some requests can be, but there is no use here, the async and await also online copy, also not make
May be because the callback is handed in according to the parameters, because of this problem, I have a headache for a day,

Therefore, consult everybody a great god, and how to convert the asynchronous to synchronous execution? The younger brother in this very grateful!!!!!
  • Related