dorukeker / gyronorm.js

JavaScript project for accessing and normalizing the accelerometer and gyroscope data on mobile devices
MIT License
640 stars 65 forks source link

Bugfix/simplify init promises #6

Closed mordack closed 9 years ago

mordack commented 9 years ago

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).