This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<template> | |
<HelloPopover /> | |
</template> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Vue from 'vue' | |
// Convert the API Postage Option format into the NEXT APP Postage option format | |
const convertPostage = (locationGroups) => (postage) => { | |
const [add, addQty] = postage.price_addl.split('/') | |
const option = { | |
flat: true, | |
cost: Number(postage.price), | |
add: Number(add), | |
addQty: addQty ? Number(addQty) : 1, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* eslint-disable no-underscore-dangle */ | |
export default (computedName) => ({ | |
watch: { | |
// We add in a mechanism to delay re-render of this component | |
// depending on derived reactive data. | |
[computedName](val) { | |
const render = this._watcher; | |
if (render && val) { | |
this._suspendGetter = render.getter; | |
render.getter = () => { render.dirty = true; }; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// This utility is to keep track of a list of keys (entity IDs no doubt) in last access | |
// order. The oldest entities can be popped off the list, and new entities can be added. | |
// The premise is a bidirectional linked list along with an ID hash to an point in the | |
// linked list. The reason behind the complexity is performance. | |
export default () => { | |
let first = null; | |
let last = null; | |
const hash = {}; | |
let size = 0; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
mutactions: { | |
async loadBooks({ state }) { | |
state.loading += 1; | |
const response = await get('/api/books'); | |
state.books = response.data.books; | |
state.loading -= 1; | |
}, | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const AsyncFunction = (async () => {}).constructor; | |
console.log((() => {}) instanceof AsyncFunction); // false | |
console.log((async () => {}) instanceof AsyncFunction); // true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
actions: { | |
loadBooks({ commit }) { | |
commit('startLoading'); | |
return get('/api/books').then((response) => { | |
commit('setBooks', response.data.books); | |
commit('stopLoading'); | |
}); | |
}, | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
actions: { | |
async loadBooks({ commit }) { | |
commit('startLoading'); | |
const response = await get('/api/books'); | |
commit('setBooks', response.data.books); | |
commit('stopLoading'); | |
}, | |
}, |
NewerOlder