1.0.0 • Published 4 years ago

request-interval1 v1.0.0

Weekly downloads
5
License
-
Repository
-
Last release
4 years ago

活动页面定时轮询组件 - request-interval

快速开始

yarn

yarn add @coding-frontend/request-interval --registry=https://codingcorp-npm.pkg.coding.net/micro-frontend/public-npm/

在模块入口添加以下逻辑

内部路由默认使用 window.codingHistory

import { RouteFunctionInterceptor, justConnect } from '@coding-frontend/route-function-interceptor';

routerFunctionsInterceptor({ key: KEY_CONFIG.TEST_MANAGEMENT })(
    withRouter(justConnect(mapStateToProps)(FeieContainer))
);

// 子应用内部有独立的 store 时, 使用公共的context避免冲突
const context = React.createContext()

routerFunctionsInterceptor({ key: KEY_CONFIG.TEST_MANAGEMENT, context })(
    withRouter(justConnect(mapStateToProps)(FeieContainer))
);

// 替换路由
routerFunctionsInterceptor({ key: KEY_CONFIG.TEST_MANAGEMENT }, window.codingHistory)(
    withRouter(justConnect(mapStateToProps)(FeieContainer))
);

接口说明

export interface IRouteFunctionInterceptorProps {
    isClosedFunction: (key: string) => boolean;
}
declare const RouteFunctionInterceptorWrapper: (options?: TOptions) => (Component: React.ElementType) => any;
export const RouteFunctionInterceptor = RouteFunctionInterceptorWrapper;
export function justConnect(store: any, actions?: {}, onContext?: AnyFn, context?: any): any;
export declare const getPdConfig: (value: string) => boolean;
export declare const isPDVersion: () => boolean;

.npmrc 参考

@coding-frontend:registry=https://codingcorp-npm.pkg.coding.net/micro-frontend/public-npm/