I just updated the docs. It's very simple: just add "isAsync": true to the action definition, make the action method an async function, and then Wait for previous actions to complete will also wait for the action.
that's great thanks
Ashley thanks for this new feature and the updated docs. A question - do you have a suggested programming pattern on how to deal with possible errors in the response? Previously in my plugins I would have different C3 triggers for success and error conditions. However, now I am thinking that I will need to add if / else clauses and new expressions to check (e.g. plugin.lastRequestSuccess, plugin.lastRequestErr) to determine what to do after the wait has been completed, instead of calling triggers. I'm thinking I don't need to add 'tags' to each request, because the wait will block execution and other trigger calls, but that probably is not correct (e.g. can other triggers be called while wait event is being processed?)
In general, what design pattern do you suggest for devs working on new plugins and utilizing the async wait SDK, for success and error handling as the result of actions?
Develop games in your browser. Powerful, performant & highly capable.
I don't think you need to specifically address this, since if you already have error triggers, if the user wants to check if the operation was successful after 'Wait for previous actions to complete' they can set a flag in the error event and then check for that flag after the action. Alternatively you can just add some success checking conditions, e.g. WebSocket's 'Is connected' condition which can be checked after the async connect action to see if there is a connection now (i.e. the connection was successful). Maybe we could adjust the design to handle this better though, but I'm not sure how that would look...