Correctly handle window loaded states

Previously if this script was executed after the window was loaded, none of the callbacks would fire.

See https://developer.mozilla.org/en-US/docs/Web/API/document.readyState for definition of detecting the `load` event.

TODO: Potentially this is redundent, since maybe using `ionic.DomUtil.ready` would mean one less listener.  However I don't know if the listeners attached to `ionic.Platform.ready` require the `document.readyState` to be `complete` rather than only `interactive`.

Linked to #2229