This repository has been archived on 2024-07-27. You can view files and clone it, but cannot push or open issues or pull requests.
keksAccountGUI/node_modulesOLD/vuetify/lib/mixins/delayable/index.js

51 lines
973 B
JavaScript
Raw Permalink Normal View History

2019-08-11 18:48:02 +00:00
import Vue from 'vue';
/**
* Delayable
*
* @mixin
*
* Changes the open or close delay time for elements
*/
export default Vue.extend().extend({
name: 'delayable',
props: {
openDelay: {
type: [Number, String],
default: 0
},
closeDelay: {
type: [Number, String],
default: 0
}
},
data: () => ({
openTimeout: undefined,
closeTimeout: undefined
}),
methods: {
/**
* Clear any pending delay timers from executing
*/
clearDelay() {
clearTimeout(this.openTimeout);
clearTimeout(this.closeTimeout);
},
/**
* Runs callback after a specified delay
*/
runDelay(type, cb) {
this.clearDelay();
const delay = parseInt(this[`${type}Delay`], 10);
this[`${type}Timeout`] = setTimeout(cb || (() => {
this.isActive = {
open: true,
close: false
}[type];
}), delay);
}
}
});
//# sourceMappingURL=index.js.map