var getVisibilityChangeMixin = function getVisibilityChangeMixin(showCallback, hiddenCallback) {
  return {
    mounted: function mounted() {
      // @ts-ignore
      window.addEventListener('visibilitychange', this._watchVisibleChange);
    },
    destroyed: function destroyed() {
      // @ts-ignore
      window.removeEventListener('visibilitychange', this._watchVisibleChange);
    },
    methods: {
      _watchVisibleChange: function _watchVisibleChange() {
        if (document.visibilityState !== 'hidden') {
          showCallback === null || showCallback === void 0 ? void 0 : showCallback.call(this);
        } else {
          hiddenCallback === null || hiddenCallback === void 0 ? void 0 : hiddenCallback.call(this);
        }
      }
    }
  };
};

export { getVisibilityChangeMixin };
