add onnline and offline event listener to keep drupalgap.onlinereliable