Skip to content

Commit 499b581

Browse files
committed
docs: show how to stop listening to model events
1 parent 02ec3e1 commit 499b581

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

docs/model-classes.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -154,6 +154,9 @@ export default {
154154
created() {
155155
this.$FeathersVuex.api.Todo.on(‘created’, this.handleTodoCreated)
156156
},
157+
destroyed() {
158+
this.$FeathersVuex.api.Todo.off(‘created’, this.handleTodoCreated)
159+
},
157160
methods: {
158161
handleTodoCreated(todo) {
159162
console.log(todo)
@@ -164,7 +167,7 @@ export default {
164167

165168
Since they have all of the EventEmitter methods, Model classes can be used as a data-layer Event Bus. You can even use custom methods:
166169

167-
```
170+
```js
168171
const { Todo } = this.$FeathersVuex.api
169172

170173
Todo.on('custom-event', data => {

0 commit comments

Comments
 (0)