-
Notifications
You must be signed in to change notification settings - Fork 145
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
增加 .d.ts 类型说明以支持 ts;优化 Y 坐标取值唯一性,列表元素为:_ka + key,非列表元素为 有 key 用 _ka,无…
… key 用 key;babel 插件 development 模式下选用 _ka 属性确定唯一值,production 模式下尽量选用 key 作为为一值;KeepAlive 可传递 id 属性以区分同父节点下的多份缓存;KeepAlive 可由非 default 部分导出;优化部分代码;更新 README
- Loading branch information
Showing
20 changed files
with
551 additions
and
175 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
docs | ||
node_modules | ||
src | ||
.babelrc | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
'use strict' | ||
|
||
module.exports = require('./lib/babel/helpers.js'); | ||
module.exports = require('./lib/babel/index.js'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
/// <reference types="react" /> | ||
import * as React from 'react' | ||
|
||
export declare class KeepAlive extends React.Component<{ | ||
children: ReactNode | ReactNodeArray, | ||
name?: string, | ||
id?: string, | ||
when?: boolean | Array<boolean> | (() => boolean | Array<boolean>) | ||
}> {} | ||
export default KeepAlive | ||
|
||
export declare class AliveScope extends React.Component<{ | ||
children: ReactNode | ReactNodeArray, | ||
}> {} | ||
|
||
export function withActivation(Component: React.ComponentClass): React.ComponentClass | ||
export function withAliveScope(Component: React.ComponentClass): React.ComponentClass | ||
|
||
export function fixContext(Context: React.Context): void | ||
export function createContext<T>( | ||
defaultValue: T, | ||
calculateChangedBits?: (prev: T, next: T) => number | ||
): Context<T> | ||
|
||
|
||
type HookLifecycleEffectCallback = () => void | ||
export function useActivate(effect: HookLifecycleEffectCallback): void | ||
export function useUnactivate(effect: HookLifecycleEffectCallback): void | ||
|
||
interface CachingNode { | ||
createTime: number, | ||
updateTime: number, | ||
name?: string, | ||
id: string | ||
} | ||
interface AliveController { | ||
drop: (name: string | RegExp) => Promise<boolean>, | ||
dropScope: (name: string | RegExp) => Promise<boolean>, | ||
clear: () => Promise<boolean>, | ||
getCachingNodes: () => Array<CachingNode> | ||
} | ||
export function useAliveController(): AliveController |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.