forked from nativescript-vue/nativescript-vue
-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.d.ts
65 lines (53 loc) · 2.04 KB
/
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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
import { Page, NavigationEntry } from 'tns-core-modules/ui/frame/frame'
import { ItemEventData } from 'tns-core-modules/ui/list-view'
import { View } from 'tns-core-modules/ui/core/view'
import { ShowModalOptions } from 'tns-core-modules/ui/core/view-base'
import { Vue, VueConstructor } from 'vue/types/vue'
// ListView ItemEventData with the addition of the item property
export type NativeScriptVueItemEventData<T> = ItemEventData & { item: T }
export interface NavigationEntryVue extends NavigationEntry {
props?: Record<string, any>,
frame?: any,
resolveOnEvent?: Page.navigatingToEvent | Page.navigatedToEvent
}
export type navigateTo = (
component: VueConstructor,
options?: NavigationEntryVue,
cb?: () => Page,
) => Promise<Page>;
export interface ModalOptions extends Partial<ShowModalOptions> {
target?: any; // optional Vue target to open the modal from
props?: Record<string, any>;
}
// create a nativescript vue class that extends vue.js
export interface NativeScriptVue<V = View> extends Vue {
nativeView: V
$navigateTo: navigateTo
$navigateBack: () => void
$modal?: { close: (data?: any) => Promise<typeof data> };
/**
* Open a modal using a component
* @param {typeof Vue} component
* @param {ModalOptions} options
* @returns {any}
*/
$showModal: (component: typeof Vue, options?: ModalOptions) => Promise<any>;
/**
* starts the nativescript application
*/
$start: () => void
}
export interface NativeScriptVueConstructor extends VueConstructor<NativeScriptVue> {
navigateTo: navigateTo
navigateBack: () => void
/**
* Registers NativeScript Plugin.
* @param elementName Name of the element to use in your template
* @param resolver function to register the element
* @param meta meta associated with the element
*/
registerElement: (elementName: string, resolver: Function, meta?: any) => void
}
export const NativeScriptVue: NativeScriptVueConstructor
// export as namespace NativeScriptVue;
export default NativeScriptVue;