mirror of
https://github.com/status-im/react-native.git
synced 2025-01-10 01:25:39 +00:00
77e48f1782
Summary: This PR adds a capability for MessageQueue to emit "SPY" events in a way that can be extensible, to later allow for a tooling ecosystem to grow, one example is the existing [Snoopy](https://github.com/jondot/rn-snoopy) tool that is, for now, forced to work with monkeypatches, and after this PR will be able to use a "formal" way to trace queue events. After this change, we can wire a "spy" into a queue that will expose the events in different and interesting ways, see below (done with Snoopy): <img src="https://github.com/jondot/rn-snoopy/blob/master/media/snoopy.gif?raw=true" alt="Aggregating and Charting Events with Bar" width="400px"/> <img src="https://github.com/jondot/rn-snoopy/blob/master/media/snoopy-filter.gif?raw=true" alt="Aggregating and Charting Events with Bar" width="400px"/> This removes the hardcoded `SPY_MODE` flag and instead uses a function that can be injected from outside world. ```javascript MessageQueue.spy((info)=>console.log("event!", info) ``` It also creates Closes https://github.com/facebook/react-native/pull/9160 Differential Revision: D3669053 Pulled By: javache fbshipit-source-id: 3e4462aa77fc8514d2ea4f15430f7bec57b583a4