Created
June 6, 2018 07:30
-
-
Save marcmo/86689f3e46c8d7cb89ea7fe5311bc5b3 to your computer and use it in GitHub Desktop.
how to debug the message queue traffic in React Native
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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