This PR simplifies the init() function significantly by making use of Promise.all to resolve when both FULLTILT.getDeviceOrientation and FULLTILT.getDeviceMotion have resolved and will then flag _isReady = true.
This also fixes a bug that could cause the promise that was returned on this line to reject more than once in case of an error being thrown in the catch calls (A promise may never be resolved/rejected more than once).
This PR simplifies the
init()
function significantly by making use ofPromise.all
to resolve when bothFULLTILT.getDeviceOrientation
andFULLTILT.getDeviceMotion
have resolved and will then flag_isReady = true
.This also fixes a bug that could cause the promise that was returned on this line to reject more than once in case of an error being thrown in the
catch
calls (A promise may never be resolved/rejected more than once).