feat: add preloadItemCount for List, incase we need preload more items before scroll to end
This commit is contained in:
2
doric-js/lib/src/runtime/global.d.ts
vendored
2
doric-js/lib/src/runtime/global.d.ts
vendored
@@ -1,6 +1,6 @@
|
||||
import { Panel } from "../ui/panel";
|
||||
import { ClassType } from "../util/types";
|
||||
export declare type BridgeContext = {
|
||||
export type BridgeContext = {
|
||||
/**
|
||||
* The identify of current context
|
||||
*/
|
||||
|
6
doric-js/lib/src/runtime/sandbox.d.ts
vendored
6
doric-js/lib/src/runtime/sandbox.d.ts
vendored
@@ -23,9 +23,9 @@ export declare function jsObtainContext(id: string): Context | undefined;
|
||||
export declare function jsReleaseContext(id: string): void;
|
||||
export declare function __require__(name: string): any;
|
||||
export declare function jsRegisterModule(name: string, moduleObject: any): void;
|
||||
export declare function jsCallEntityMethod(contextId: string, methodName: string, args?: any): any;
|
||||
export declare function pureCallEntityMethod(contextId: string, methodName: string, args?: any): any;
|
||||
declare type ClassType<T> = new (...args: any) => T;
|
||||
export declare function jsCallEntityMethod(contextId: string, methodName: string, args?: any): unknown;
|
||||
export declare function pureCallEntityMethod(contextId: string, methodName: string, args?: any): unknown;
|
||||
type ClassType<T> = new (...args: any) => T;
|
||||
export declare function jsObtainEntry(contextId: string): () => ClassType<object> | ((constructor: ClassType<object>) => ClassType<object>);
|
||||
export declare function jsCallbackTimer(timerId: number): void;
|
||||
export declare function jsHookAfterNativeCall(): void;
|
||||
|
@@ -71,6 +71,16 @@ export function jsCallReject(contextId, callbackId, args) {
|
||||
}
|
||||
}
|
||||
export class Context {
|
||||
hookBeforeNativeCall() {
|
||||
if (this.entity && Reflect.has(this.entity, 'hookBeforeNativeCall')) {
|
||||
Reflect.apply(Reflect.get(this.entity, 'hookBeforeNativeCall'), this.entity, []);
|
||||
}
|
||||
}
|
||||
hookAfterNativeCall() {
|
||||
if (this.entity && Reflect.has(this.entity, 'hookAfterNativeCall')) {
|
||||
Reflect.apply(Reflect.get(this.entity, 'hookAfterNativeCall'), this.entity, []);
|
||||
}
|
||||
}
|
||||
constructor(id) {
|
||||
this.callbacks = new Map;
|
||||
this.classes = new Map;
|
||||
@@ -105,16 +115,6 @@ export class Context {
|
||||
}
|
||||
});
|
||||
}
|
||||
hookBeforeNativeCall() {
|
||||
if (this.entity && Reflect.has(this.entity, 'hookBeforeNativeCall')) {
|
||||
Reflect.apply(Reflect.get(this.entity, 'hookBeforeNativeCall'), this.entity, []);
|
||||
}
|
||||
}
|
||||
hookAfterNativeCall() {
|
||||
if (this.entity && Reflect.has(this.entity, 'hookAfterNativeCall')) {
|
||||
Reflect.apply(Reflect.get(this.entity, 'hookAfterNativeCall'), this.entity, []);
|
||||
}
|
||||
}
|
||||
callNative(namespace, method, args) {
|
||||
const callbackId = uniqueId('callback');
|
||||
return new Promise((resolve, reject) => {
|
||||
|
Reference in New Issue
Block a user