react-native/docs
grgmo d09cd62011 Add support for ontimeout and onerror handler when using XMLHttpRequest for Android and iOS
Summary:Currently React-Native does not have `ontimeout` and `onerror` handlers for [XMLHttpRequest](https://developer.mozilla.org/en-US/docs/Web/API/XMLHttpRequest). This is an extension to [No timeout on XMLHttpRequest](https://github.com/facebook/react-native/issues/4648).

With addition to two handlers, both Android and iOS can now handle `ontimeout` if request times out and `onerror` when there is general network error.

**Test plan**

Code has been tested on both Android and iOS with [Charles](https://www.charlesproxy.com/) by setting a breakpoint on the request which fires `ontimeout` when the request waits beyond `timeout` time and `onerror` when there is network error.

**Usage**

JavaScript -

```
var request = new XMLHttpRequest();

function onLoad() {
    console.log(request.status);
};

function onTimeout() {
    console.log('Timeout');
};

function onError() {
    console.log('General network error');
};

request.onload = onLoad;
request.ontimeout = onTimeout;
request.onerr
Closes https://github.com/facebook/react-native/pull/6841

Differential Revision: D3178859

Pulled By: lexs

fb-gh-sync-id: 30674570653e92ab5f7e74bd925dd5640fc862b6
fbshipit-source-id: 30674570653e92ab5f7e74bd925dd5640fc862b6
2016-04-15 05:17:21 -07:00
..
Accessibility.md React.findNodeHandle -> ReactNative.findNodeHandle 2016-04-07 19:44:31 -07:00
AndroidBuildingFromSource.md Add download links for Android NDK to the docs 2016-03-26 10:44:18 -07:00
AndroidUIPerformance.md CI now builds docs website and deploys it to /%version% path 2016-02-11 06:17:42 -08:00
Animations.md Use es6 in animation examples 2016-04-06 09:23:20 -07:00
Colors.md Add support for number as colors 2016-02-08 04:04:38 -08:00
CommunicationIOS.md fix es6 class method 2016-02-15 14:55:36 -08:00
Debugging.md Added support for JavaScript third-party debuggers 2016-04-07 13:15:58 -07:00
DevelopmentSetupAndroid.md Update DevelopmentSetupAndroid.md 2016-04-12 09:43:19 -07:00
DirectManipulation.md Fix broken link for shouldComponentUpdate 2016-04-12 19:50:20 -07:00
EmbeddedAppAndroid.md Update EmbeddedAppAndroid.md 2016-03-24 07:11:30 -07:00
EmbeddedAppIOS.md CHORE - Remove Trailing Spaces 2016-04-06 09:21:53 -07:00
GestureResponderSystem.md CI now builds docs website and deploys it to /%version% path 2016-02-11 06:17:42 -08:00
GettingStarted.md Update GettingStarted.md 2016-04-11 11:35:24 -07:00
GettingStartedOnLinux.md Update GettingStartedOnLinux.md 2016-04-10 14:54:21 -07:00
Images.md Add note about adding new images 2016-03-06 02:07:23 -08:00
IssueGuidelines.md CHORE - Remove Trailing Spaces 2016-04-06 09:21:53 -07:00
JavaScriptEnvironment.md CHORE - Remove Trailing Spaces 2016-04-06 09:21:53 -07:00
KnownIssues.md Android Slider is now open sourced 2016-04-07 07:29:28 -07:00
LinkingLibraries.md CI now builds docs website and deploys it to /%version% path 2016-02-11 06:17:42 -08:00
LinuxWindowsSupport.md CHORE - Remove Trailing Spaces 2016-04-06 09:21:53 -07:00
MoviesExample.json Fix typo and add comments to the example app 2015-03-27 20:44:20 +00:00
NativeComponentsAndroid.md Fix broken link 2016-03-02 04:36:33 -08:00
NativeComponentsIOS.md Added a small note about an issue I ran into vending a simple `UIView? 2016-04-04 04:36:19 -07:00
NativeModulesAndroid.md Improve Android native module doc 2016-04-01 10:08:19 -07:00
NativeModulesIOS.md Added objective-c class/module semantics 2016-03-08 07:07:27 -08:00
NavigatorComparison.md Update NavigatorComparison.md 2016-04-10 11:51:18 -07:00
Network.md Add support for ontimeout and onerror handler when using XMLHttpRequest for Android and iOS 2016-04-15 05:17:21 -07:00
Newsletter.md Introduce blog 2016-03-24 14:11:30 -07:00
Performance.md LayoutAnimation now works on android 2016-03-06 09:22:25 -08:00
PixelRatio.md Move around the docs a bit 2015-03-25 11:52:29 -07:00
PlatformSpecificInformation.md Fix Platform.Version documentation 2016-02-24 06:21:34 -08:00
PullRequestGuidelines.md Tweak commands and guidelines 2016-03-20 13:14:25 -07:00
RunningOnDeviceAndroid.md Adds alternative method of opening the dev menu using `adb shell input keyevent 82` 2016-01-06 21:28:16 -05:00
RunningOnDeviceIOS.md CI now builds docs website and deploys it to /%version% path 2016-02-11 06:17:42 -08:00
SignedAPKAndroid.md Update SignedAPKAndroid.md 2016-04-06 09:04:20 -07:00
Style.md CI now builds docs website and deploys it to /%version% path 2016-02-11 06:17:42 -08:00
Testing.md Fix typo in Testing.md 2015-12-11 15:22:57 +01:00
Text.md CHORE - Remove Trailing Spaces 2016-04-06 09:21:53 -07:00
Timers.md Add timer usage for es6 2016-03-26 05:42:26 -07:00
Troubleshooting.md replace require with es6 import in docs 2016-02-14 15:03:34 -08:00
Tutorial.md Tutorial: Add a link to makeitopen.com 2016-04-14 05:33:20 -07:00
Upgrading.md CI now builds docs website and deploys it to /%version% path 2016-02-11 06:17:42 -08:00
Videos.md Introduce blog 2016-03-24 14:11:30 -07:00