mirror of
https://github.com/robonen/tools.git
synced 2026-03-20 19:04:46 +00:00
refactor: change separate tools by category
This commit is contained in:
21
web/vue/src/utils/components.ts
Normal file
21
web/vue/src/utils/components.ts
Normal file
@@ -0,0 +1,21 @@
|
||||
import { getCurrentInstance, type ComponentInternalInstance } from 'vue';
|
||||
|
||||
/**
|
||||
* @name getLifeCycleTarger
|
||||
* @category Utils
|
||||
* @description Function to get the target instance of the lifecycle hook
|
||||
*
|
||||
* @param {ComponentInternalInstance} target The target instance of the lifecycle hook
|
||||
* @returns {ComponentInternalInstance | null} Instance of the lifecycle hook or null
|
||||
*
|
||||
* @example
|
||||
* const target = getLifeCycleTarger();
|
||||
*
|
||||
* @example
|
||||
* const target = getLifeCycleTarger(instance);
|
||||
*
|
||||
* @since 0.0.1
|
||||
*/
|
||||
export function getLifeCycleTarger(target?: ComponentInternalInstance) {
|
||||
return target || getCurrentInstance();
|
||||
}
|
||||
13
web/vue/src/utils/error.ts
Normal file
13
web/vue/src/utils/error.ts
Normal file
@@ -0,0 +1,13 @@
|
||||
/**
|
||||
* @name VueToolsError
|
||||
* @category Error
|
||||
* @description VueToolsError is a custom error class that represents an error in Vue Tools
|
||||
*
|
||||
* @since 0.0.1
|
||||
*/
|
||||
export class VueToolsError extends Error {
|
||||
constructor(message: string) {
|
||||
super(message);
|
||||
this.name = 'VueToolsError';
|
||||
}
|
||||
}
|
||||
2
web/vue/src/utils/index.ts
Normal file
2
web/vue/src/utils/index.ts
Normal file
@@ -0,0 +1,2 @@
|
||||
export * from './components';
|
||||
export * from './error';
|
||||
Reference in New Issue
Block a user