Skip to content

Instantly share code, notes, and snippets.

@marcmo
Created June 6, 2018 07:30
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save marcmo/86689f3e46c8d7cb89ea7fe5311bc5b3 to your computer and use it in GitHub Desktop.
Save marcmo/86689f3e46c8d7cb89ea7fe5311bc5b3 to your computer and use it in GitHub Desktop.
how to debug the message queue traffic in React Native
import MessageQueue, { TO_JS } from 'react-native/Libraries/BatchedBridge/MessageQueue.js';
const handleCallsToJS = (info) => {
// ...
};
const handleCallsToNative = (info) => {
// ...
};
const spyFunction = (info) => {
if (info.type === TO_JS) {
handleCallsToJS(info);
} else {
handleCallsToNative(info);
}
};
export const enableSpy = () => {
MessageQueue.spy(spyFunction);
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment