Fix 'online' event handling on Cordova

`document.addEventListener` and `addEventListener` makes huge difference on my Cordova application.
Without this fix, `removeEventListener('online', resourceManagerListener)` crashes the whole application and makes `$cachedResource` impossible to be loaded.

This short bugfix will make it work everywhere.