Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/eseom/vue-nes
vuejs hapi nes plugin
https://github.com/eseom/vue-nes
hapi nes vue websocket
Last synced: 20 days ago
JSON representation
vuejs hapi nes plugin
- Host: GitHub
- URL: https://github.com/eseom/vue-nes
- Owner: eseom
- Created: 2017-05-24T09:59:30.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2017-05-30T03:38:17.000Z (over 7 years ago)
- Last Synced: 2024-12-09T19:18:20.616Z (about 1 month ago)
- Topics: hapi, nes, vue, websocket
- Language: TypeScript
- Size: 6.84 KB
- Stars: 2
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# vue-nes
> vue plugin support for hapi-nes
[![npm version][npm-badge]][npm-url]
You can use this plugin to add NES(websocket for hapijs) support to your vue application. The messages pass through the synced store, and you can get those messages at anywhere.
# requirements
- vuex# Usage
Example:
```js
// vuejs boot file
import VueNes from 'vue-nes'// usually websocket url is localhost:
const wsUrl = `ws${window.location.protocol === 'https:' ? 's' : ''}://${window.location.host}`
Vue.use(VueNes, { wsUrl, store } )// store generator
import { vuexModule as socketVuexModule } from 'vue-nes'const store = new Vuex.Store({
actions,
getters,
modules: {
.
.
nes: socketVuexModule,
.
.
},
strict: true,
})// in components
// Register component scoped subscriptions
// We can get messages from store when we're in the component
{{message.code}}
export default {
.
.
nes: {
subscribe: [
'/item/6', // you can receive from this subscription on this component, and all child components.
],
},
.
.
computed: {
message() {
this.$store.state.nes.message // you can get broadcast messages from server at here
}
},
}```
# development
```
git clone https://github.com/eseom/vue-nes
cd vue-nes
yarn
yarn link
yarn watch# (and open a new terminal)
cd /path/to/your_vue_project
yarn link vue-nes# enjoy it
```[npm-url]: https://www.npmjs.com/package/vue-nes
[npm-badge]: https://img.shields.io/npm/v/vue-nes.svg