I have begun studying LeoVue. I have run across mystifying javascript syntax that googling does not resolve. Any explanation would be welcome.
leovue/src/store/index.js contains the Vue store <https://vuex.vuejs.org/en/intro.html>. For study I have refactored this as follows: // ========= The Store =============== export default new Vuex.Store({ state: { << state >> }, mutations: { << mutations >> }, actions: { << actions >> } }) The state object is simply as set of key/value pairs, as expected. But the mutations and actions sections do not seem to be key/value pairs. They look more like lists enclosed {}. The first two entries in the actions (object?) are: ADDDATASET (state, o) { state.dataSets[o.k] = o.v }, ADDDATATABLE (state, o) { state.dataTables[o.k] = o.v }, These look kinda like function definitions without "function" or "=>". But various descriptions of so-called object initializers don't seem to explain this syntax. As another example, this appears near the start the page What is Vuex? <https://vuex.vuejs.org/en/intro.html> : new Vue({ // state data () { return { count: 0 } }, // view template: ` <div>{{ count }}</div> `, // actions methods: { increment () { this.count++ } } }) Again, I assume that the first '{' starts an object. The template: key contains a string object. But huh?, the data and increment (functions?) do not seem to be key/value pairs. Are these functions *evaluated* when creating the object, to yield a key/value pair? Can anyone explain what's going on? Where is the reference? Edward -- You received this message because you are subscribed to the Google Groups "leo-editor" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at https://groups.google.com/group/leo-editor. For more options, visit https://groups.google.com/d/optout.
