Debounce
This commit is contained in:
@@ -18,7 +18,7 @@
|
||||
|
||||
<script>
|
||||
import cookie from './cookie.mjs';
|
||||
import { uniq, strHashHSL } from './util.mjs';
|
||||
import { uniq, strHashHSL, debounce } from './util.mjs';
|
||||
|
||||
import Autocomplete from './Autocomplete.vue';
|
||||
|
||||
@@ -66,8 +66,8 @@
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
async params(value) {
|
||||
this.appointments = value.selection.length > 0 ? (await this.client.SDEC_CLINLET(value.selection.join('|') + '|', datefm(value.date_begin), datefm(value.date_end))).sort((a, b) => (new Date(a.ApptDate)) - (new Date(b.ApptDate))) : [];
|
||||
params(value) {
|
||||
this.debounced_params(value);
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
@@ -80,6 +80,9 @@
|
||||
cookie.set('vista.practitioner', JSON.stringify(this.practitioner), 1);
|
||||
}
|
||||
},
|
||||
created() {
|
||||
this.debounced_params = debounce(async function(value) { this.appointments = value.selection.length > 0 ? (await this.client.SDEC_CLINLET(value.selection.join('|') + '|', datefm(value.date_begin), datefm(value.date_end))).sort((a, b) => (new Date(a.ApptDate)) - (new Date(b.ApptDate))) : []; }, 500);
|
||||
},
|
||||
async mounted() {
|
||||
var practitioner = cookie.get('vista.practitioner');
|
||||
if(practitioner) this.practitioner = JSON.parse(practitioner);
|
||||
|
Reference in New Issue
Block a user