mirror of
https://github.com/robonen/tools.git
synced 2026-03-20 10:54:44 +00:00
refactor(packages/vue): some fixes, add resumable type
This commit is contained in:
@@ -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';
|
||||
export * from './useToggle';
|
||||
|
||||
@@ -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';
|
||||
|
||||
|
||||
30
packages/vue/src/types/resumable.ts
Normal file
30
packages/vue/src/types/resumable.ts
Normal 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;
|
||||
}
|
||||
Reference in New Issue
Block a user