vue.js - Vuex: Tracking Mutations On Object/Class Properties -


i'm attempting track mutations on properties in other js classes or objects, changes aren't being broadcasted views include them, while other properties defined in state object broadcasted when mutated.

vuex store

export default new vuex.store({   state: {     audio: new audio()   },   getters: {     duration: state => {      return state.audio.duration     },     currenttime: state => {       return state.audio.currenttime     }   } }); 

vue template

<template>   <div class="component">     {{ currenttime }} :: {{ duration }}   </div> </template>  <script> export default {   name: 'component',   computed: {     currenttime() {       return this.$store.getters.currenttime     },     duration() {       return this.$store.getters.duration     }   } } </script> 

current time , duration always "0" in template. there built-in mechanisms track these mutations, or need write custom solution, such unfortunately needing examine currenttime every second (if audio active)


Comments

Popular posts from this blog

angular - Ionic slides - dynamically add slides before and after -

minify - Minimizing css files -

Add a dynamic header in angular 2 http provider -