adaptlearning / adapt-contrib-xapi

TinCan/xAPI extension for the Adapt Framework
GNU General Public License v3.0
12 stars 27 forks source link

issues/101 Fixed state setting asynchronously #102

Closed cahirodoherty-learningpool closed 2 years ago

cahirodoherty-learningpool commented 2 years ago

fixes #101

Swapped out Async.each for a for/in loop to resolve async/await issues

oliverfoster commented 2 years ago

Did it fix the problem? I can't see how the code is different from before, with the exception of https://github.com/adaptlearning/adapt-contrib-xapi/pull/102/files#diff-b0b5ab3ca1ad9e3f2e6a5f7f072256b8d933fdcdb7f6b929fd463257fde05229R1130 if (!_.isEmpty(state)) {

Could you do as discussed and remove src/libraries/async.min.js and the import directive from the async libraries where it's not used?

You'll need to do the same this with for + promise await here https://github.com/adaptlearning/adapt-contrib-xapi/blob/master/js/XAPI.js#L1156

cahirodoherty-learningpool commented 2 years ago

Hi Oli, yeah this fixed the issue. The await is now being respected and the state is getting populated correctly. I'll remove the async library here now

cahirodoherty-learningpool commented 2 years ago

@oliverfoster The Async library has now been removed

cahirodoherty-learningpool commented 2 years ago

@oliverfoster Indentation and return of resolve now fixed