'use strict';

Object.defineProperty(exports, '__esModule', { value: true });

var vue = require('vue');

function useLock(duration = 250) {
  let lock = null;
  let timeout;
  vue.onBeforeUnmount(() => {
    clearTimeout(timeout);
  });
  function doLock(locked) {
    if (locked || lock === null)
      lock = locked;
    clearTimeout(timeout);
    timeout = setTimeout(() => {
      lock = null;
    }, duration);
  }
  return [() => lock, doLock];
}

exports.default = useLock;
//# sourceMappingURL=useLock.cjs.map
