Guide / JavaScript /

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.observeProperty(state.todos, 'length')

    text: "Finish documentation",
    completed: false

For a more detailed documentation have a look createObserver

Next step