Match-id-293b5d8b9c2678e17d9ccda1aeae0b5e13d2396e
This commit is contained in:
parent
bc580894b7
commit
06e73eb131
|
@ -61,7 +61,7 @@ export function getSelectPropsWithoutValue(dom: HorizonSelect, properties: Objec
|
|||
};
|
||||
}
|
||||
|
||||
export function updateSelectValue(dom: HorizonSelect, props: Props, isInit: boolean = false) {
|
||||
export function updateSelectValue(dom: HorizonSelect, props: Props, isInit = false) {
|
||||
const {value, defaultValue, multiple} = props;
|
||||
|
||||
const oldMultiple = dom._multiple !== undefined ? dom._multiple : dom.multiple;
|
||||
|
|
|
@ -45,7 +45,7 @@ export function getTextareaPropsWithoutValue(dom: HTMLTextAreaElement, propertie
|
|||
};
|
||||
}
|
||||
|
||||
export function updateTextareaValue(dom: HTMLTextAreaElement, props: Props, isInit: boolean = false) {
|
||||
export function updateTextareaValue(dom: HTMLTextAreaElement, props: Props, isInit = false) {
|
||||
if (isInit) {
|
||||
const initValue = getInitValue(props);
|
||||
if (initValue !== '') {
|
||||
|
|
|
@ -19,7 +19,7 @@ import { createContext } from '../../renderer/components/context/CreateContext';
|
|||
import { createElement } from '../../external/JSXElement';
|
||||
import { BoundActionCreator } from './redux';
|
||||
import { ReduxAction } from './redux';
|
||||
import { ReduxStoreHandler } from '../store/StoreHandler'
|
||||
import { ReduxStoreHandler } from '../store/StoreHandler';
|
||||
|
||||
const DefaultContext = createContext(null);
|
||||
type Context = typeof DefaultContext;
|
||||
|
|
|
@ -109,7 +109,7 @@ export class Observer implements IObserver {
|
|||
}
|
||||
|
||||
allChange(): void {
|
||||
let keyIt = this.keyVNodes.keys();
|
||||
const keyIt = this.keyVNodes.keys();
|
||||
let keyItem = keyIt.next();
|
||||
while (!keyItem.done) {
|
||||
this.setProp(keyItem.value);
|
||||
|
|
|
@ -42,8 +42,8 @@ export function get(rawObj: object, key: string | symbol, receiver: any, singleL
|
|||
observer.watchers[prop].push(handler);
|
||||
return ()=>{
|
||||
observer.watchers[prop]=observer.watchers[prop].filter(cb=>cb!==handler);
|
||||
}
|
||||
}
|
||||
};
|
||||
};
|
||||
}
|
||||
|
||||
if (key === 'addListener') {
|
||||
|
|
|
@ -78,7 +78,7 @@ function createClassErrorUpdate(
|
|||
return update;
|
||||
}
|
||||
function isPromise(error: any): error is PromiseType<any> {
|
||||
return error !== null && typeof error === 'object' && typeof error.then === 'function'
|
||||
return error !== null && typeof error === 'object' && typeof error.then === 'function';
|
||||
}
|
||||
// 处理capture和bubble阶段抛出的错误
|
||||
export function handleRenderThrowError(
|
||||
|
|
|
@ -19,7 +19,7 @@ import type {PortalType} from '../Types';
|
|||
export function createPortal(
|
||||
children: any,
|
||||
realNode: any,
|
||||
key: string = '',
|
||||
key = '',
|
||||
): PortalType {
|
||||
return {
|
||||
vtype: TYPE_PORTAL,
|
||||
|
|
|
@ -35,7 +35,7 @@ function collectDeps<T>(vNode: VNode, context: ContextType<T>) {
|
|||
}
|
||||
}
|
||||
|
||||
export function getNewContext<T>(vNode: VNode, ctx: ContextType<T>, isUseContext: boolean = false): T {
|
||||
export function getNewContext<T>(vNode: VNode, ctx: ContextType<T>, isUseContext = false): T {
|
||||
// 如果来自于useContext,则需要在函数组件中调用
|
||||
if (isUseContext && getHookStage() === null) {
|
||||
throwNotInFuncError();
|
||||
|
|
|
@ -37,7 +37,7 @@ export function useContext<T>(
|
|||
return getNewContext(processingVNode!, Context, true);
|
||||
}
|
||||
|
||||
export function useState<S>(initialState: (() => S) | S,): [S, Dispatch<BasicStateAction<S>>] {
|
||||
export function useState<S>(initialState: (() => S) | S): [S, Dispatch<BasicStateAction<S>>] {
|
||||
return useStateImpl(initialState);
|
||||
}
|
||||
|
||||
|
|
|
@ -26,7 +26,7 @@ import {getHookStage, HookStage} from './HookStage';
|
|||
import {isArrayEqual} from '../utils/compare';
|
||||
import {getProcessingVNode} from '../GlobalVar';
|
||||
|
||||
export function useEffectImpl(effectFunc: () => (() => void) | void, deps?: Array<any> | null,): void {
|
||||
export function useEffectImpl(effectFunc: () => (() => void) | void, deps?: Array<any> | null): void {
|
||||
// 异步触发的effect
|
||||
useEffect(effectFunc, deps, EffectConstant.Effect);
|
||||
}
|
||||
|
|
|
@ -21,7 +21,7 @@ import {
|
|||
import {getHookStage, HookStage} from './HookStage';
|
||||
import {isArrayEqual} from '../utils/compare';
|
||||
|
||||
export function useMemoImpl<V>(fun: () => V, deps?: Array<any> | null,): V {
|
||||
export function useMemoImpl<V>(fun: () => V, deps?: Array<any> | null): V {
|
||||
const stage = getHookStage();
|
||||
if (stage === null) {
|
||||
throwNotInFuncError();
|
||||
|
|
|
@ -137,7 +137,7 @@ function updateReducerHookState<S, A>(currentHookUpdates, currentHook, reducer):
|
|||
|
||||
// 计算stateValue值
|
||||
function calculateNewState<S, A>(currentHookUpdates: Array<Update<S, A>>, currentHook, reducer: (S, A) => S) {
|
||||
let reducerObj = currentHook.state;
|
||||
const reducerObj = currentHook.state;
|
||||
let state = reducerObj.stateValue;
|
||||
|
||||
// 循环遍历更新数组,计算新的状态值
|
||||
|
|
|
@ -31,7 +31,7 @@ import {EffectConstant} from '../hooks/EffectConstant';
|
|||
let hookEffects: Array<HookEffect | VNode> = [];
|
||||
let hookRemoveEffects: Array<HookEffect | VNode> = [];
|
||||
// 是否正在异步调度effects
|
||||
let isScheduling: boolean = false;
|
||||
let isScheduling = false;
|
||||
|
||||
export function setSchedulingEffects(value) {
|
||||
isScheduling = value;
|
||||
|
|
|
@ -172,7 +172,7 @@ function attachRef(vNode: VNode) {
|
|||
}
|
||||
|
||||
function detachRef(vNode: VNode, isOldRef?: boolean) {
|
||||
let ref = (isOldRef ? vNode.oldRef : vNode.ref);
|
||||
const ref = (isOldRef ? vNode.oldRef : vNode.ref);
|
||||
|
||||
handleRef(vNode, ref, null);
|
||||
}
|
||||
|
|
|
@ -41,7 +41,7 @@ let rootThrowError = null;
|
|||
|
||||
// 防止死循环调用update
|
||||
const LOOPING_UPDATE_LIMIT = 50;
|
||||
let loopingUpdateCount: number = 0;
|
||||
let loopingUpdateCount = 0;
|
||||
let lastRoot: VNode | null = null;
|
||||
|
||||
export function submitToRender(treeRoot) {
|
||||
|
|
|
@ -74,7 +74,7 @@ export function getLazyVNodeTag(lazyComp: any): string {
|
|||
} else if (lazyComp !== undefined && lazyComp !== null && typeLazyMap[lazyComp.vtype]) {
|
||||
return typeLazyMap[lazyComp.vtype];
|
||||
}
|
||||
throw Error("Horizon can't resolve the content of lazy");
|
||||
throw Error('Horizon can\'t resolve the content of lazy');
|
||||
}
|
||||
|
||||
// 创建processing
|
||||
|
|
|
@ -4,7 +4,8 @@
|
|||
"libs/*"
|
||||
],
|
||||
"scripts": {
|
||||
"lint": "eslint . --ext .ts",
|
||||
"lint": "eslint . --ext .ts --fix",
|
||||
"prettier": "prettier -w libs/**/*.ts",
|
||||
"build": "rollup --config ./scripts/rollup/rollup.config.js",
|
||||
"build:watch": "rollup --watch --config ./scripts/rollup/rollup.config.js",
|
||||
"build:3rdLib": "node ./scripts/gen3rdLib.js build:3rdLib",
|
||||
|
|
Loading…
Reference in New Issue