'use strict';

var vue = require('vue');
var useIDBKeyval$1 = require('@vueuse/integrations/useIDBKeyval');
var core = require('@vueuse/core');

const useIDBKeyval = (key, initialValue, options) => {
  const { data, isFinished, set } = useIDBKeyval$1.useIDBKeyval(key, initialValue, options);
  const IDBInitResult = core.createEventHook();
  const initIndexedDBComplete = async () => {
    if (isFinished.value) {
      return;
    }
    return new Promise((resolve) => {
      IDBInitResult.on(resolve);
    });
  };
  vue.watch(isFinished, (newValue) => {
    if (newValue) {
      IDBInitResult.trigger();
    }
  });
  return {
    data,
    isFinished,
    set,
    initIndexedDBComplete
  };
};

exports.useIDBKeyval = useIDBKeyval;
//# sourceMappingURL=index.js.map
