vue-feathers
Feathers is a minimalist real-time web framework written in JavaScript. Vue-Feathers is a plugin for Vue.js that integrates it with Feathers.
NOTE: It's supposed to be compatible both with Vue 1.x and 2.x. It requires IE9+ or Safari 5+
Install
npm install vue-feathers --save
Usage
// Include and set up feathers clientconst Feathers =const hooks =const authentication =const socketio =const io =const socket =const feathers =// Include it as a CommonJS moduleconst Vue =const vueFeathers =// And plug it inVue
Now in every component you get a new property called $services
, which allows you to interact with all of your Feathers services:
this$servicesmessages// orthis$servicesmessages
To subscribe on the events your services generate, you just need to use a separate feathers
section in your component:
{return...}methods:...feathers: // here is our sectionmessages: // here is the subsection for the 'messages' service{...}{...}
Vue-feathers does all the clean up before your component is destroyed (using the removeListener
function).
In case you need to do something more complex, there is a $feathers
property for that:
this$feathers