/
types.ts
32 lines (28 loc) · 928 Bytes
/
types.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
import { ChildAppData } from '@harpsealjs/framework';
import { EventListener } from '@harpsealjs/event';
import { HashType } from '@harpsealjs/hijack-history';
export interface MicrofeAPI {
on(action: string, callback: EventListener): this;
off(action: string, callback: EventListener): this;
pushState(url: string, state: any): this;
replaceState(url: string, state: any): this;
register(child: ChildAppData): this;
root(dom: HTMLElement): this;
start(): this;
exit(): this;
clear(): this;
};
export interface ChildContext {
root: HTMLElement | null,
base: string | null | undefined,
hashType: HashType,
onAppLeave(cb: EventListener): void
};
type Chainable = {chain: (...args: any[]) => Chainable};
export interface Plugin {
create: () => Chainable,
hijack?: () => Chainable,
clear?: () => Chainable,
unhijack?: () => Chainable,
setGlobal?: (global: Window | null) => () => Chainable
};