-
Notifications
You must be signed in to change notification settings - Fork 7
/
index.d.ts
48 lines (44 loc) · 973 Bytes
/
index.d.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
import type { App } from "vue";
import type { v1, v3, v4, v5 } from "uuid";
export interface UUID {
v1: typeof v1;
v3: typeof v3;
v4: typeof v4;
v5: typeof v5;
}
declare module "@vue/runtime-core" {
export interface ComponentCustomProperties {
/**
* An object with uuid's v1, v3, v4 and v5 functions.
*/
$uuid: UUID;
}
}
/**
* An object with uuid's v1, v3, v4 and v5 functions.
*/
export const uuid: UUID;
/**
* Defines '$uuid' property globally, to be accessed in any component instance
* inside the application. The '$uuid' is an object with uuid's v1, v3, v4 and
* v5 functions.
*
* @example
* import Vue from 'vue';
* import withUUID from 'vue-uuid';
*
* const app = withUUID(
* createApp({
* // ...
* }),
* );
*
* app.component('c-button', {
* created() {
* this.id = this.$uuid.v4();
* }
* });
*/
export default function withUUID<HostElement = any>(
app: App<HostElement>
): App<HostElement>;