mirror of
https://github.com/zhigang1992/react-native.git
synced 2026-04-23 03:50:11 +08:00
Summary:- Get rid of no longer necessary WebSocket.js v WebSocketBase.js split - Use `EventTarget(list, of, events)` as base class to auto-generate `oneventname` getters/setters that get invoked along with other event handlers - Type annotation `any` considered harmful, especially when we can easily spell out the actual type - Throw in some `const` goodness for free **Test Plan:** Launch UIExplorer example app, supplied `websocket_test_server` script, and try different combinations of sending and receiving text and binary data on both iOS and Android. Closes https://github.com/facebook/react-native/pull/6889 Differential Revision: D3184835 Pulled By: mkonicek fb-gh-sync-id: f21707f4e97aa5a79847f5157e0a9f132a1a01cd fbshipit-source-id: f21707f4e97aa5a79847f5157e0a9f132a1a01cd
19 lines
476 B
JavaScript
19 lines
476 B
JavaScript
// Jest fatals for the following statement (minimal repro case)
|
|
//
|
|
// exports.something = Symbol;
|
|
//
|
|
// Until it is fixed, mocking the entire node module makes the
|
|
// problem go away.
|
|
|
|
'use strict';
|
|
|
|
function EventTarget() {
|
|
// Support both EventTarget and EventTarget([list, of, events])
|
|
// as a super class, just like the original module does.
|
|
if (arguments.length === 1 && Array.isArray(arguments[0])) {
|
|
return EventTarget;
|
|
}
|
|
}
|
|
|
|
module.exports = EventTarget;
|