1
0
mirror of https://github.com/robonen/tools.git synced 2026-03-20 02:44:45 +00:00

refactor(packages/vue): some fixes, add resumable type

This commit is contained in:
2024-10-06 06:47:53 +07:00
parent 2e5e477097
commit d48e6469a3
3 changed files with 36 additions and 2 deletions

View File

@@ -1,5 +1,9 @@
export * from './useCached';
export * from './useContextFactory';
export * from './useCounter';
export * from './useLastChanged';
export * from './useMounted';
export * from './useRenderCount';
export * from './useSupported';
export * from './useSyncRefs';
export * from './useToggle';

View File

@@ -1,6 +1,6 @@
import { describe, it, expect } from 'vitest';
import { defineComponent } from 'vue';
import { useContextFactory } from './index';
import { useContextFactory } from '.';
import { mount } from '@vue/test-utils';
import { VueToolsError } from '../../utils';

View File

@@ -0,0 +1,30 @@
/**
* Often times, we want to pause and resume a process. This is a common pattern in
* reactive programming. This interface defines the options and actions for a resumable
* process.
*/
/**
* The options for a resumable process.
*
* @typedef {Object} ResumableOptions
* @property {boolean} [immediate] Whether to immediately resume the process
*
*/
export interface ResumableOptions {
immediate?: boolean;
}
/**
* The actions for a resumable process.
*
* @typedef {Object} ResumableActions
* @property {Function} resume Resumes the process
* @property {Function} pause Pauses the process
* @property {Function} toggle Toggles the process
*/
export interface ResumableActions {
resume: () => void;
pause: () => void;
toggle: () => void;
}