Add support for firing 'deviceready' events registered before cordova-js is loaded.

Tested on iOS.