new async wait SDK?

0 favourites
  • 5 posts
  • Will there be specifications on how to add the new async wait feature to javascript sdk? this is very awesome!! will it be as simple as marking the action function as async? or are there other requirements to signal the engine the work is done?

  • 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?

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • 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...

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)