https://github.com/rxreactnative/react-native-rxemitter
emit: support React-Native / Vue / Nuxt. (广播、通知)
https://github.com/rxreactnative/react-native-rxemitter
nuxt react react-native react-native-web vue
Last synced: 3 months ago
JSON representation
emit: support React-Native / Vue / Nuxt. (广播、通知)
- Host: GitHub
- URL: https://github.com/rxreactnative/react-native-rxemitter
- Owner: RXReactNative
- License: mit
- Created: 2019-12-20T05:56:56.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2021-08-12T02:31:42.000Z (almost 5 years ago)
- Last Synced: 2024-04-25T11:03:33.596Z (about 2 years ago)
- Topics: nuxt, react, react-native, react-native-web, vue
- Language: JavaScript
- Homepage:
- Size: 20.5 KB
- Stars: 2
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# react-native-rxemitter
React-Native / Vue / Nuxt
: `Broadcast notification` - `广播`
```sh
npm install react-native-rxemitter --save-dev
# or
yarn add react-native-rxemitter --dev
```
## Usage
```js
//- - - -
// 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');
```