-
Notifications
You must be signed in to change notification settings - Fork 113
/
index.d.ts
41 lines (35 loc) · 1.41 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
/// <reference types="react" />
/// <reference types="react-router" />
import * as React from 'react'
import { SwitchProps, RouteProps } from 'react-router-dom'
export interface CacheRouteProps extends RouteProps {
className?: string
when?: 'forward' | 'back' | 'always' | ((props: CacheRouteProps) => boolean)
behavior?: (isCached: boolean) => object | void
cacheKey?: string | ((props: CacheRouteProps) => string),
unmount?: boolean
saveScrollPosition?: boolean
multiple?: boolean | number
autoFreeze?: boolean
}
export declare class CacheRoute extends React.Component<CacheRouteProps> {}
export default CacheRoute
export interface CacheSwitchProps extends SwitchProps {
which?: (element: React.ElementType) => boolean
autoFreeze?: boolean
}
export declare class CacheSwitch extends React.Component<CacheSwitchProps> {}
export function dropByCacheKey(cacheKey: string): void
export function refreshByCacheKey(cacheKey: string): void
export function getCachingKeys(): Array<string>
export function clearCache(): void
export interface CachingComponent extends React.ComponentClass {
__cacheCreateTime: number
__cacheUpdateTime: number
}
export interface CachingComponentMap {
[key: string]: CachingComponent
}
export function getCachingComponents(): CachingComponentMap
export function useDidCache(effect: () => void, deps?: any[]): void
export function useDidRecover(effect: () => void, deps?: any[]): void