react-native/Libraries/Network
Philipp von Weitershausen b5f14ea8f1 Make XMLHttpRequest and XMLHttpRequest.upload proper EventTargets
Summary:
So far, XHR only supports a few `onfoo` event handlers, not the entier `EventTarget` interface (`addEventListener`, `removeEventListener`). It also doesn't support the `upload` object on Android -- for no good reason. Even if we don't send any events there yet, there's no reason we have to break consuming code that wants to register an event handler there. This PR rectifies all that.

Fortunately, adding proper `EventTarget` support is very easy thanks to `event-target-shim`. We already use it in our WebSocket implementation. It transparently handles the `addEventListener('foo', ...)` as well as `onfoo` APIs, so when you dispatch an event on the event target, the right handlers will be invoked. The event object is wrapped so that `event.target` is set properly. Basically, it's a super easy way to make us conform to the spec.

Also added a bit of polish here and there, using ES2015 class property goodness to consolidate a lot of Flow property definitions with the corresponding property initializers.

**T
Closes https://github.com/facebook/react-native/pull/7017

Reviewed By: fkgozali

Differential Revision: D3202021

Pulled By: martinbigio

fb-gh-sync-id: 2b007682074356c75c774fab337672918b6c4355
fbshipit-source-id: 2b007682074356c75c774fab337672918b6c4355
2016-04-28 15:59:26 -07:00
..
RCTNetwork.xcodeproj Added RCTDataRequestHandler 2015-10-19 09:07:06 -07:00
__tests__ Make XMLHttpRequest and XMLHttpRequest.upload proper EventTargets 2016-04-28 15:59:26 -07:00
FormData.js Remove double to string convertion in FormData 2016-04-06 09:01:30 -07:00
NetInfo.js Fix fbsource errors 2016-03-09 16:54:24 -08:00
RCTDataRequestHandler.h Added RCTDataRequestHandler 2015-10-19 09:07:06 -07:00
RCTDataRequestHandler.m Fix retain cyles in RCTNetworkTask when used with RCTFileRequestHandler and RCTDataRequestHandler 2015-11-04 07:16:26 -08:00
RCTFileRequestHandler.h Added RCTFileRequestHandler 2015-10-13 08:14:28 -07:00
RCTFileRequestHandler.m Replaced RCTSparseArray with NSDictionary 2015-11-14 10:28:28 -08:00
RCTHTTPRequestHandler.h Refactored networking logic out into RCTDownloadTask 2015-07-23 04:00:31 -08:00
RCTHTTPRequestHandler.m Refactored module access to allow for lazy loading 2015-11-25 04:49:45 -08:00
RCTNetInfo.h Rename RCTReachability to RCTNetInfo 2015-08-14 08:20:01 -08:00
RCTNetInfo.m getCurrentConnectivity should resolve with object 2016-03-09 16:30:30 -08:00
RCTNetworkTask.h Added throttling on requests made by RCTImageLoader 2016-02-16 12:42:34 -08:00
RCTNetworkTask.m Added throttling on requests made by RCTImageLoader 2016-02-16 12:42:34 -08:00
RCTNetworking.android.js Implement XHR timeout for Android and IOS natively. 2016-01-18 08:10:59 -08:00
RCTNetworking.h Added RCTDataRequestHandler 2015-10-19 09:07:06 -07:00
RCTNetworking.ios.js ensure that RCTNetworking JS function names are consistent with android 2015-11-18 15:48:29 -08:00
RCTNetworking.m Add support for ontimeout and onerror handler when using XMLHttpRequest for Android and iOS 2016-04-15 05:17:21 -07:00
XMLHttpRequest.android.js Make XMLHttpRequest and XMLHttpRequest.upload proper EventTargets 2016-04-28 15:59:26 -07:00
XMLHttpRequest.ios.js Make XMLHttpRequest and XMLHttpRequest.upload proper EventTargets 2016-04-28 15:59:26 -07:00
XMLHttpRequestBase.js Make XMLHttpRequest and XMLHttpRequest.upload proper EventTargets 2016-04-28 15:59:26 -07:00