React-Native / Vue / Nuxt
: Broadcast notification
- 广播
npm install react-native-rxemitter --save-dev
# or
yarn add react-native-rxemitter --dev
//- - - -
// add listener (React -> componentDidMount)
// (Vue/Nuxt -> created)
RXEmitter.addListener(this, 'gotoHome', ()=>{
// ...
});
// remove listener (React -> componentWillUnmount)
// (Vue/Nuxt -> destroyed)
RXEmitter.remove(this, 'gotoHome');
//- - - -
// send eitter (anywhere)
RXEmitter.emit('gotoHome');