forked from cerebral/overmind
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.ts
More file actions
54 lines (47 loc) · 1.2 KB
/
index.ts
File metadata and controls
54 lines (47 loc) · 1.2 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
import { EventType, IConfiguration, Overmind } from 'overmind'
import { createElement } from './createElement'
import { patch, setApp } from './utils'
export interface IComponent<
Config extends IConfiguration,
Props = {},
State = undefined
> {
(
props: Props,
overmind: {
state: State
changeState: (newState: Partial<State>) => void
appState: Overmind<Config>['state']
actions: Overmind<Config>['actions']
effects: Overmind<Config>['effects']
reaction: Overmind<Config>['reaction']
}
): any
getInitialState?: (props: Props) => State
}
export type Child = React.ReactNode
declare global {
// @ts-ignore
namespace JSX {
interface IntrinsicElements {
self: React.DetailedHTMLProps<
React.HtmlHTMLAttributes<HTMLHtmlElement>,
HTMLHtmlElement
>
}
}
}
declare module 'react' {
interface HTMLAttributes<T> extends React.DOMAttributes<T> {
onMount?: (el: HTMLElement) => void | (() => void)
onEnter?: (el: HTMLElement) => void | (() => void)
class?: {
[key: string]: boolean
}
}
}
const render = (app, vnode, container) => {
setApp(app)
patch(container, vnode())
}
export { createElement, render }