-
Notifications
You must be signed in to change notification settings - Fork 57
Expand file tree
/
Copy pathindex.d.ts
More file actions
116 lines (95 loc) · 2.68 KB
/
index.d.ts
File metadata and controls
116 lines (95 loc) · 2.68 KB
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
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
import { NullstackClientContext } from './ClientContext'
import { NullstackNode } from './JSX'
import { NullstackPlugin } from './Plugin'
import { NullstackServerContext } from './ServerContext'
export * from './ClientContext'
export * from './Environment'
export * from './Instances'
export * from './Page'
export * from './Params'
export * from './Plugin'
export * from './Project'
export * from './Request'
export * from './Response'
export * from './Router'
export * from './Secrets'
export * from './Server'
export * from './ServerContext'
export * from './Settings'
export * from './Worker'
export * from './JSX'
/**
* Functional component
*
* @example
*
* ```
* import { NullstackClientContext, NullstackFunctionalComponent } from 'nullstack';
*
* interface InputProps {
* label: string;
* }
*
* function Input({ label, page }: NullstackClientContext<InputProps>) {
* console.log(page.title);
* return <p>{label}</p>;
* }
*
* export default Input as NullstackFunctionalComponent<InputProps>;
* ```
*/
export type NullstackFunctionalComponent<TProps> = (props: TProps) => NullstackNode;
export default class Nullstack<TProps = unknown> {
constructor(props?: TProps)
/**
* @param App A Nullstack app root component
*/
static start(App: typeof this): NullstackClientContext | NullstackServerContext
/**
* Use a plugin
*/
static use(Plugin: NullstackPlugin): void
/**
* Could run on the server or client.
* @see https://nullstack.app/full-stack-lifecycle#prepare
*/
prepare?(context: NullstackClientContext<TProps>)
/**
* Could run on the server or client.
* @see https://nullstack.app/full-stack-lifecycle#initiate
*/
initiate?(context: NullstackClientContext<TProps>)
initiated: boolean
/**
* Could run on the server or client.
* @see https://nullstack.app/full-stack-lifecycle#launch
*/
launch?(context: NullstackClientContext<TProps>)
/**
* Runs on the client.
* @see https://nullstack.app/full-stack-lifecycle#hydrate
*/
hydrate?(context: NullstackClientContext<TProps>)
hydrated: boolean
/**
* Runs on the client.
* @see https://nullstack.app/full-stack-lifecycle#update
*/
update?(context: NullstackClientContext<TProps>)
/**
* Runs on the client.
* @see https://nullstack.app/full-stack-lifecycle#terminate
*/
terminate?(context: NullstackClientContext<TProps>)
terminated: boolean
render?(context: NullstackClientContext<TProps>): NullstackNode
[_property: `render${Capitalize<string>}`]: Nullstack['render']
prerendered: boolean
/**
* If the component is persistent
*
* @see https://nullstack.app/persistent-components
*/
persistent: boolean
key: string
}