Permalink
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
32 lines (16 sloc) 574 Bytes

Create an observer

Once we have register our state the next step is create an observer that listen for mutations.

const observer = dop.createObserver(mutations => {
    // This will be executed after the push()
    console.log(state.todos[0].text) // "Finish documentation"
})
observer.observe(state.todos, 'length')

state.todos.push({
    text: "Finish documentation",
    completed: false
})

For a more detailed documentation have a look createObserver

Next step

Actions