@lynx-js/react 0.129.0 → 0.129.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +14 -0
- package/components/tsconfig.tsbuildinfo +1 -1
- package/package.json +3 -4
- package/refresh/.turbo/turbo-build.log +1 -1
- package/runtime/__test__/core/hooks/useLynxGlobalEventListener.test.jsx +1 -1
- package/runtime/__test__/element-template/imports/no-legacy-imports.test.ts +7 -6
- package/runtime/__test__/element-template/internal/legacy-internal-guardrail.test.ts +1 -2
- package/runtime/__test__/element-template/native/main-thread-api.test.ts +5 -2
- package/runtime/__test__/element-template/native/mts-destroy.test.ts +83 -0
- package/runtime/__test__/element-template/native/reload-dual-thread-communication.test.ts +3 -0
- package/runtime/__test__/element-template/native/reload.test.ts +31 -2
- package/runtime/__test__/element-template/runtime/background/update-timing.test.ts +15 -0
- package/runtime/__test__/element-template/runtime/patch/element-template-patch.test.tsx +197 -7
- package/runtime/__test__/element-template/runtime/patch/update-timing.test.ts +4 -1
- package/runtime/__test__/element-template/runtime/render/render-direct-suspense.test.ts +4 -1
- package/runtime/__test__/element-template/runtime/render/render-direct.test.ts +4 -1
- package/runtime/__test__/element-template/runtime/render/render-main-thread.test.ts +101 -1
- package/runtime/__test__/element-template/runtime/template/element-template-handle.test.ts +32 -0
- package/runtime/__test__/element-template/runtime/template/main-thread-dynamic-attr-state.test.ts +121 -26
- package/runtime/__test__/element-template/test-utils/debug/envManager.ts +8 -5
- package/runtime/__test__/element-template/test-utils/mock/mockNativePapi.ts +35 -2
- package/runtime/__test__/guardrails/snapshot-containment.test.ts +45 -11
- package/runtime/__test__/shared/component-stack.test.ts +211 -0
- package/runtime/__test__/snapshot/debug/formatPatch.test.ts +0 -8
- package/runtime/__test__/snapshot/gesture/prepareGestureForCommit.test.js +1 -1
- package/runtime/__test__/snapshot/lynx/timing.test.jsx +3 -0
- package/runtime/__test__/snapshot/preact.test.jsx +0 -3
- package/runtime/__test__/snapshot/snapshotPatch.test.jsx +0 -33
- package/runtime/__test__/worklet-runtime/jsFunctionLifecycle.test.js +12 -0
- package/runtime/__test__/worklet-runtime/loadRuntime.test.js +68 -0
- package/runtime/__test__/worklet-runtime/workletRuntime.test.js +30 -0
- package/runtime/lazy/element-template-internal.js +0 -1
- package/runtime/lazy/internal.js +1 -1
- package/runtime/lazy/jsx-dev-runtime.js +1 -1
- package/runtime/lazy/jsx-runtime.js +1 -1
- package/runtime/lazy/legacy-react-runtime.js +1 -1
- package/runtime/lazy/react-lepus.js +1 -1
- package/runtime/lazy/react.js +1 -1
- package/runtime/lib/core/capture-main-thread-object.js +2 -1
- package/runtime/lib/core/capture-main-thread-object.js.map +1 -1
- package/runtime/lib/core/compat/legacy-react-runtime.js +1 -1
- package/runtime/lib/core/compat/legacy-react-runtime.js.map +1 -1
- package/runtime/lib/core/lynx/lazy-bundle.js +1 -1
- package/runtime/lib/core/lynx/lazy-bundle.js.map +1 -1
- package/runtime/lib/core/lynx-data-processors.d.ts +125 -1
- package/runtime/lib/core/lynx-data-processors.js +3 -0
- package/runtime/lib/core/lynx-data-processors.js.map +1 -1
- package/runtime/lib/core/runtime-destroy.js +1 -1
- package/runtime/lib/core/runtime-destroy.js.map +1 -1
- package/runtime/lib/document.js +0 -5
- package/runtime/lib/document.js.map +1 -1
- package/runtime/lib/element-template/background/commit-hook.js +11 -12
- package/runtime/lib/element-template/background/commit-hook.js.map +1 -1
- package/runtime/lib/element-template/client/root.d.ts +1 -1
- package/runtime/lib/element-template/client/root.js.map +1 -1
- package/runtime/lib/element-template/index.d.ts +2 -2
- package/runtime/lib/element-template/index.js.map +1 -1
- package/runtime/lib/element-template/internal.d.ts +1 -1
- package/runtime/lib/element-template/internal.js +0 -13
- package/runtime/lib/element-template/internal.js.map +1 -1
- package/runtime/lib/element-template/lynx/env.js.map +1 -1
- package/runtime/lib/element-template/native/flush.d.ts +1 -0
- package/runtime/lib/element-template/native/flush.js +9 -0
- package/runtime/lib/element-template/native/flush.js.map +1 -0
- package/runtime/lib/element-template/native/main-thread-api.js +3 -7
- package/runtime/lib/element-template/native/main-thread-api.js.map +1 -1
- package/runtime/lib/element-template/native/mts-destroy.js +8 -2
- package/runtime/lib/element-template/native/mts-destroy.js.map +1 -1
- package/runtime/lib/element-template/native/patch-listener.js +57 -50
- package/runtime/lib/element-template/native/patch-listener.js.map +1 -1
- package/runtime/lib/element-template/native/reload-main-thread.js +2 -1
- package/runtime/lib/element-template/native/reload-main-thread.js.map +1 -1
- package/runtime/lib/element-template/protocol/types.js.map +1 -1
- package/runtime/lib/element-template/runtime/page/root-instance.d.ts +0 -1
- package/runtime/lib/element-template/runtime/page/root-instance.js.map +1 -1
- package/runtime/lib/element-template/runtime/patch.js +4 -0
- package/runtime/lib/element-template/runtime/patch.js.map +1 -1
- package/runtime/lib/element-template/runtime/render/render-components.js +4 -4
- package/runtime/lib/element-template/runtime/render/render-components.js.map +1 -1
- package/runtime/lib/element-template/runtime/render/render-main-thread.js +2 -0
- package/runtime/lib/element-template/runtime/render/render-main-thread.js.map +1 -1
- package/runtime/lib/element-template/runtime/template/main-thread-background-function.js +8 -1
- package/runtime/lib/element-template/runtime/template/main-thread-background-function.js.map +1 -1
- package/runtime/lib/element-template/runtime/template/main-thread-dynamic-attr-state.d.ts +1 -0
- package/runtime/lib/element-template/runtime/template/main-thread-dynamic-attr-state.js +41 -21
- package/runtime/lib/element-template/runtime/template/main-thread-dynamic-attr-state.js.map +1 -1
- package/runtime/lib/element-template/runtime/template/main-thread-ref-ctx.d.ts +1 -1
- package/runtime/lib/element-template/runtime/template/main-thread-ref-ctx.js.map +1 -1
- package/runtime/lib/internal.d.ts +1 -1
- package/runtime/lib/internal.js +1 -1
- package/runtime/lib/internal.js.map +1 -1
- package/runtime/lib/lynx-api.d.ts +2 -125
- package/runtime/lib/lynx-api.js.map +1 -1
- package/runtime/lib/shared/component-stack.d.ts +0 -4
- package/runtime/lib/shared/component-stack.js +21 -5
- package/runtime/lib/shared/component-stack.js.map +1 -1
- package/runtime/lib/snapshot/gesture/{processGestureBagkround.js → processGestureBackground.js} +1 -1
- package/runtime/lib/snapshot/gesture/processGestureBackground.js.map +1 -0
- package/runtime/lib/snapshot/lifecycle/patch/snapshotPatch.d.ts +0 -1
- package/runtime/lib/snapshot/lifecycle/patch/snapshotPatch.js +0 -5
- package/runtime/lib/snapshot/lifecycle/patch/snapshotPatch.js.map +1 -1
- package/runtime/lib/snapshot/lifecycle/patch/snapshotPatchApply.js +0 -10
- package/runtime/lib/snapshot/lifecycle/patch/snapshotPatchApply.js.map +1 -1
- package/runtime/lib/snapshot/lifecycle/patch/updateMainThread.js +56 -51
- package/runtime/lib/snapshot/lifecycle/patch/updateMainThread.js.map +1 -1
- package/runtime/lib/snapshot/list/listUpdateInfo.js +0 -30
- package/runtime/lib/snapshot/list/listUpdateInfo.js.map +1 -1
- package/runtime/lib/snapshot/lynx/calledByNative.js +11 -8
- package/runtime/lib/snapshot/lynx/calledByNative.js.map +1 -1
- package/runtime/lib/snapshot/renderToOpcodes/hydrate.js +0 -52
- package/runtime/lib/snapshot/renderToOpcodes/hydrate.js.map +1 -1
- package/runtime/lib/snapshot/renderToOpcodes/index.js +10 -10
- package/runtime/lib/snapshot/renderToOpcodes/index.js.map +1 -1
- package/runtime/lib/snapshot/renderToOpcodes/opcodes.js +0 -51
- package/runtime/lib/snapshot/renderToOpcodes/opcodes.js.map +1 -1
- package/runtime/lib/snapshot/snapshot/backgroundSnapshot.js +1 -1
- package/runtime/lib/snapshot/snapshot/backgroundSnapshot.js.map +1 -1
- package/runtime/lib/tsconfig.tsbuildinfo +1 -1
- package/runtime/lib/worklet-runtime/bindings/index.d.ts +1 -0
- package/runtime/lib/worklet-runtime/bindings/index.js +1 -0
- package/runtime/lib/worklet-runtime/bindings/index.js.map +1 -1
- package/runtime/lib/worklet-runtime/bindings/loadRuntime.d.ts +8 -0
- package/runtime/lib/worklet-runtime/bindings/loadRuntime.js +23 -0
- package/runtime/lib/worklet-runtime/bindings/loadRuntime.js.map +1 -0
- package/runtime/lib/worklet-runtime/jsFunctionLifecycle.d.ts +2 -0
- package/runtime/lib/worklet-runtime/jsFunctionLifecycle.js +6 -0
- package/runtime/lib/worklet-runtime/jsFunctionLifecycle.js.map +1 -1
- package/runtime/lib/worklet-runtime/workletRuntime.js +2 -0
- package/runtime/lib/worklet-runtime/workletRuntime.js.map +1 -1
- package/runtime/package.json +2 -3
- package/runtime/src/core/capture-main-thread-object.ts +2 -1
- package/runtime/src/core/compat/legacy-react-runtime.ts +1 -1
- package/runtime/src/core/lynx/lazy-bundle.ts +1 -1
- package/runtime/src/core/lynx-data-processors.ts +124 -1
- package/runtime/src/core/runtime-destroy.ts +1 -1
- package/runtime/src/document.ts +0 -6
- package/runtime/src/element-template/background/commit-hook.ts +18 -12
- package/runtime/src/element-template/client/root.ts +1 -3
- package/runtime/src/element-template/index.ts +2 -2
- package/runtime/src/element-template/internal.ts +0 -20
- package/runtime/src/element-template/lynx/env.ts +1 -1
- package/runtime/src/element-template/native/flush.ts +10 -0
- package/runtime/src/element-template/native/main-thread-api.ts +3 -6
- package/runtime/src/element-template/native/mts-destroy.ts +7 -2
- package/runtime/src/element-template/native/patch-listener.ts +62 -57
- package/runtime/src/element-template/native/reload-main-thread.ts +2 -1
- package/runtime/src/element-template/protocol/types.ts +0 -13
- package/runtime/src/element-template/runtime/page/root-instance.ts +0 -1
- package/runtime/src/element-template/runtime/patch.ts +5 -0
- package/runtime/src/element-template/runtime/render/render-components.ts +3 -3
- package/runtime/src/element-template/runtime/render/render-main-thread.ts +2 -0
- package/runtime/src/element-template/runtime/template/main-thread-background-function.ts +8 -1
- package/runtime/src/element-template/runtime/template/main-thread-dynamic-attr-state.ts +51 -21
- package/runtime/src/element-template/runtime/template/main-thread-ref-ctx.ts +2 -2
- package/runtime/src/element-template/types.d.ts +6 -0
- package/runtime/src/internal.ts +1 -1
- package/runtime/src/lynx-api.ts +2 -124
- package/runtime/src/shared/component-stack.ts +22 -5
- package/runtime/src/snapshot/lifecycle/patch/snapshotPatch.ts +0 -5
- package/runtime/src/snapshot/lifecycle/patch/snapshotPatchApply.ts +0 -10
- package/runtime/src/snapshot/lifecycle/patch/updateMainThread.ts +62 -58
- package/runtime/src/snapshot/list/listUpdateInfo.ts +0 -52
- package/runtime/src/snapshot/lynx/calledByNative.ts +11 -9
- package/runtime/src/snapshot/renderToOpcodes/hydrate.ts +0 -58
- package/runtime/src/snapshot/renderToOpcodes/index.ts +8 -8
- package/runtime/src/snapshot/renderToOpcodes/opcodes.ts +0 -57
- package/runtime/src/snapshot/snapshot/backgroundSnapshot.ts +1 -1
- package/runtime/src/worklet-runtime/README.md +30 -10
- package/runtime/src/worklet-runtime/bindings/index.ts +2 -0
- package/runtime/src/worklet-runtime/bindings/loadRuntime.ts +25 -0
- package/runtime/src/worklet-runtime/jsFunctionLifecycle.ts +6 -0
- package/runtime/src/worklet-runtime/workletRuntime.ts +2 -0
- package/runtime/vitest.config.ts +0 -2
- package/testing-library/.turbo/turbo-build.log +6 -6
- package/testing-library/src/__tests__/act.test.jsx +0 -7
- package/testing-library/src/__tests__/alog.test.jsx +12 -54
- package/testing-library/src/__tests__/end-to-end.test.jsx +0 -7
- package/testing-library/src/__tests__/renderComponent.test.jsx +0 -14
- package/testing-library/src/__tests__/worklet.test.jsx +49 -0
- package/transform/.turbo/turbo-build$colon$wasm.log +98 -376
- package/transform/__test__/defines.spec.js +30 -0
- package/transform/__test__/object-methods.spec.js +79 -0
- package/transform/crates/swc_plugin_worklet/extract_ident.rs +99 -49
- package/transform/crates/swc_plugin_worklet/gen_stmt.rs +56 -48
- package/transform/crates/swc_plugin_worklet/lib.rs +393 -589
- package/transform/crates/swc_plugin_worklet/napi.rs +4 -6
- package/transform/crates/swc_plugin_worklet/tests/__swc_snapshots__/lib.rs/should_extract_member_expr_2_js.js +6 -1
- package/transform/crates/swc_plugin_worklet/tests/__swc_snapshots__/lib.rs/should_extract_member_expr_2_lepus.js +7 -1
- package/transform/crates/swc_plugin_worklet/tests/__swc_snapshots__/lib.rs/should_extract_member_expr_js.js +9 -0
- package/transform/crates/swc_plugin_worklet/tests/__swc_snapshots__/lib.rs/should_extract_member_expr_lepus.js +12 -1
- package/transform/crates/swc_plugin_worklet/tests/__swc_snapshots__/lib.rs/should_preserve_main_thread_objects_in_class_js.js +1 -1
- package/transform/crates/swc_plugin_worklet/tests/__swc_snapshots__/lib.rs/should_preserve_main_thread_objects_in_class_lepus.js +1 -1
- package/transform/dist/wasm.cjs +1 -1
- package/transform/package.json +0 -1
- package/transform/src/lib.rs +1 -1
- package/transform/swc-plugin-reactlynx/.turbo/turbo-build.log +113 -42
- package/transform/swc-plugin-reactlynx/src/lib.rs +1 -4
- package/transform/swc-plugin-reactlynx/swc_plugin_reactlynx.wasm +0 -0
- package/transform/swc-plugin-reactlynx-compat/.turbo/turbo-build.log +273 -66
- package/runtime/lib/snapshot/gesture/processGestureBagkround.js.map +0 -1
- package/runtime/lib/snapshot/worklet/hmr.d.ts +0 -1
- package/runtime/lib/snapshot/worklet/hmr.js +0 -28
- package/runtime/lib/snapshot/worklet/hmr.js.map +0 -1
- package/runtime/src/snapshot/worklet/hmr.ts +0 -34
- /package/runtime/lib/snapshot/gesture/{processGestureBagkround.d.ts → processGestureBackground.d.ts} +0 -0
- /package/runtime/src/snapshot/gesture/{processGestureBagkround.ts → processGestureBackground.ts} +0 -0
|
@@ -17,6 +17,7 @@ import { ElementTemplateLifecycleConstant } from '../protocol/lifecycle-constant
|
|
|
17
17
|
import type { ElementTemplateUpdateCommitContext } from '../protocol/types.js';
|
|
18
18
|
import type { ElementTemplateUpdateEvent } from '../protocol/update-event.js';
|
|
19
19
|
import { applyElementTemplateUpdateCommands } from '../runtime/patch.js';
|
|
20
|
+
import { applyPendingMainThreadRefAttachments } from '../runtime/template/main-thread-dynamic-attr-state.js';
|
|
20
21
|
|
|
21
22
|
let listener:
|
|
22
23
|
| ((event: Pick<ElementTemplateUpdateEvent, 'data'>) => void)
|
|
@@ -38,79 +39,83 @@ export function installElementTemplatePatchListener(): void {
|
|
|
38
39
|
});
|
|
39
40
|
}
|
|
40
41
|
setPipeline(pipelineOptions);
|
|
41
|
-
|
|
42
|
-
|
|
42
|
+
try {
|
|
43
|
+
markTiming('mtsRenderStart');
|
|
44
|
+
markTiming('parseChangesStart');
|
|
43
45
|
|
|
44
|
-
|
|
45
|
-
|
|
46
|
+
const payload = JSON.parse(event.data.payload) as ElementTemplateUpdateCommitContext;
|
|
47
|
+
markTiming('parseChangesEnd');
|
|
46
48
|
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
49
|
+
if (
|
|
50
|
+
typeof patchOptions.reloadVersion === 'number'
|
|
51
|
+
&& patchOptions.reloadVersion < getReloadVersion()
|
|
52
|
+
) {
|
|
53
|
+
markTiming('mtsRenderEnd');
|
|
54
|
+
if (shouldProfilePatch) {
|
|
55
|
+
lynx.performance.profileEnd();
|
|
56
|
+
}
|
|
57
|
+
return;
|
|
54
58
|
}
|
|
55
|
-
return;
|
|
56
|
-
}
|
|
57
59
|
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
if (hasOps) {
|
|
63
|
-
if (typeof __ALOG__ !== 'undefined' && __ALOG__) {
|
|
64
|
-
console.alog?.(
|
|
65
|
-
'[ReactLynxDebug] ElementTemplate main-thread patch:\n'
|
|
66
|
-
+ JSON.stringify(
|
|
67
|
-
{
|
|
68
|
-
ops: formatElementTemplateUpdateCommands(payload.ops),
|
|
69
|
-
flushOptions,
|
|
70
|
-
flowIds,
|
|
71
|
-
},
|
|
72
|
-
null,
|
|
73
|
-
2,
|
|
74
|
-
),
|
|
75
|
-
);
|
|
76
|
-
}
|
|
77
|
-
markTiming('patchChangesStart');
|
|
60
|
+
const hasOps = payload.ops.length > 0;
|
|
61
|
+
const flushOptions = payload.flushOptions;
|
|
62
|
+
const isHydration = payload.isHydration === true;
|
|
63
|
+
const delayedRunOnMainThreadData = payload.delayedRunOnMainThreadData;
|
|
78
64
|
try {
|
|
79
|
-
|
|
65
|
+
if (hasOps) {
|
|
66
|
+
if (typeof __ALOG__ !== 'undefined' && __ALOG__) {
|
|
67
|
+
console.alog?.(
|
|
68
|
+
'[ReactLynxDebug] ElementTemplate main-thread patch:\n'
|
|
69
|
+
+ JSON.stringify(
|
|
70
|
+
{
|
|
71
|
+
ops: formatElementTemplateUpdateCommands(payload.ops),
|
|
72
|
+
flushOptions,
|
|
73
|
+
flowIds,
|
|
74
|
+
},
|
|
75
|
+
null,
|
|
76
|
+
2,
|
|
77
|
+
),
|
|
78
|
+
);
|
|
79
|
+
}
|
|
80
|
+
markTiming('patchChangesStart');
|
|
81
|
+
try {
|
|
82
|
+
applyElementTemplateUpdateCommands(payload.ops, isHydration);
|
|
83
|
+
} finally {
|
|
84
|
+
markTiming('patchChangesEnd');
|
|
85
|
+
markTiming('mtsRenderEnd');
|
|
86
|
+
}
|
|
87
|
+
} else {
|
|
88
|
+
markTiming('mtsRenderEnd');
|
|
89
|
+
}
|
|
90
|
+
applyPendingMainThreadRefAttachments();
|
|
80
91
|
} finally {
|
|
81
|
-
markTiming('patchChangesEnd');
|
|
82
|
-
markTiming('mtsRenderEnd');
|
|
83
92
|
if (isHydration) {
|
|
84
93
|
flushDelayedRunOnBackgroundFunctions();
|
|
85
94
|
clearFirstScreenMainThreadRefs();
|
|
86
95
|
}
|
|
87
96
|
}
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
try {
|
|
98
|
-
for (const data of delayedRunOnMainThreadData) {
|
|
99
|
-
try {
|
|
100
|
-
runRunOnMainThreadTask(data.worklet, data.params as ClosureValueType[], data.resolveId);
|
|
101
|
-
} catch (error) {
|
|
102
|
-
lynx.reportError(error as Error);
|
|
97
|
+
if (delayedRunOnMainThreadData?.length) {
|
|
98
|
+
setEomShouldFlushElementTree(false);
|
|
99
|
+
try {
|
|
100
|
+
for (const data of delayedRunOnMainThreadData) {
|
|
101
|
+
try {
|
|
102
|
+
runRunOnMainThreadTask(data.worklet, data.params as ClosureValueType[], data.resolveId);
|
|
103
|
+
} catch (error) {
|
|
104
|
+
lynx.reportError(error as Error);
|
|
105
|
+
}
|
|
103
106
|
}
|
|
107
|
+
} finally {
|
|
108
|
+
setEomShouldFlushElementTree(true);
|
|
104
109
|
}
|
|
105
|
-
} finally {
|
|
106
|
-
setEomShouldFlushElementTree(true);
|
|
107
110
|
}
|
|
108
|
-
}
|
|
109
111
|
|
|
110
|
-
|
|
112
|
+
__FlushElementTree(undefined, flushOptions);
|
|
111
113
|
|
|
112
|
-
|
|
113
|
-
|
|
114
|
+
if (shouldProfilePatch) {
|
|
115
|
+
lynx.performance.profileEnd();
|
|
116
|
+
}
|
|
117
|
+
} finally {
|
|
118
|
+
setPipeline(undefined);
|
|
114
119
|
}
|
|
115
120
|
};
|
|
116
121
|
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
// Licensed under the Apache License Version 2.0 that can be found in the
|
|
3
3
|
// LICENSE file in the root directory of this source tree.
|
|
4
4
|
|
|
5
|
+
import { flushElementTemplate } from './flush.js';
|
|
5
6
|
import { onMtsDestruction } from './mts-destroy.js';
|
|
6
7
|
import {
|
|
7
8
|
canReEvalMainThreadEntry,
|
|
@@ -66,7 +67,7 @@ export function reloadMainThread(data: unknown, options: UpdatePageOption): void
|
|
|
66
67
|
setRoot({ __jsx: oldRoot.__jsx });
|
|
67
68
|
renderMainThread();
|
|
68
69
|
|
|
69
|
-
|
|
70
|
+
flushElementTemplate(options);
|
|
70
71
|
} finally {
|
|
71
72
|
if (typeof __PROFILE__ !== 'undefined' && __PROFILE__) {
|
|
72
73
|
profileEnd();
|
|
@@ -199,20 +199,7 @@ export type ElementTemplateUpdateCommand =
|
|
|
199
199
|
export type ElementTemplateUpdateCommandStream = ElementTemplateUpdateCommand[number][];
|
|
200
200
|
|
|
201
201
|
export interface ElementTemplateFlushOptions {
|
|
202
|
-
// triggerLayout?: boolean;
|
|
203
|
-
// operationID?: any;
|
|
204
|
-
// __lynx_timing_flag?: string;
|
|
205
|
-
// nativeUpdateDataOrder?: number;
|
|
206
|
-
// elementID?: number;
|
|
207
|
-
// listID?: number;
|
|
208
|
-
// listReuseNotification?: {
|
|
209
|
-
// listElement: FiberElement;
|
|
210
|
-
// itemKey: string;
|
|
211
|
-
// };
|
|
212
202
|
pipelineOptions?: PipelineOptions;
|
|
213
|
-
// elementIDs?: number[];
|
|
214
|
-
// operationIDs?: any[];
|
|
215
|
-
// asyncFlush?: boolean;
|
|
216
203
|
triggerDataUpdated?: boolean;
|
|
217
204
|
emptyPatch?: boolean;
|
|
218
205
|
}
|
|
@@ -16,6 +16,8 @@ import {
|
|
|
16
16
|
} from './list/list.js';
|
|
17
17
|
import type { ETListFlushResult, ETListUpdateItem } from './list/list.js';
|
|
18
18
|
import { insertElementTemplateSubtree } from './template/handle.js';
|
|
19
|
+
import { retainMainThreadBackgroundFunctionCtx } from './template/main-thread-background-function.js';
|
|
20
|
+
import type { MTEventNativeWrapper } from './template/main-thread-event-ctx.js';
|
|
19
21
|
import { elementTemplateRegistry } from './template/registry.js';
|
|
20
22
|
import { TYPED_ELEMENT_ATTRIBUTES_SLOT_INDEX } from './template/typed-attributes.js';
|
|
21
23
|
import { ElementTemplateUpdateOps } from '../protocol/opcodes.js';
|
|
@@ -138,6 +140,9 @@ export function applyElementTemplateUpdateCommands(
|
|
|
138
140
|
if (!nativeRef) {
|
|
139
141
|
continue;
|
|
140
142
|
}
|
|
143
|
+
if (value != null) {
|
|
144
|
+
retainMainThreadBackgroundFunctionCtx((value as unknown as MTEventNativeWrapper).value);
|
|
145
|
+
}
|
|
141
146
|
__SetAttributeOfElementTemplate(nativeRef, attrSlotIndex, value);
|
|
142
147
|
updateMainThreadEventAttrSlot(targetId, attrSlotIndex, value, isHydration);
|
|
143
148
|
break;
|
|
@@ -40,7 +40,7 @@ const assign = /* @__PURE__ */ Object.assign;
|
|
|
40
40
|
// Global state for the current render pass
|
|
41
41
|
export let beforeDiff: ((vnode: unknown) => void) | undefined;
|
|
42
42
|
export let beforeDiff2: ((vnode: unknown, context: Record<string, unknown>) => void) | undefined;
|
|
43
|
-
let afterDiff, renderHook,
|
|
43
|
+
let afterDiff, renderHook, unmountHook;
|
|
44
44
|
|
|
45
45
|
export function renderWithHooks(
|
|
46
46
|
vnode: unknown,
|
|
@@ -62,7 +62,7 @@ export function renderWithHooks(
|
|
|
62
62
|
beforeDiff2 = options[DIFF2];
|
|
63
63
|
afterDiff = options[DIFFED];
|
|
64
64
|
renderHook = options[RENDER];
|
|
65
|
-
|
|
65
|
+
unmountHook = options.unmount;
|
|
66
66
|
|
|
67
67
|
const parent = h(Fragment, null);
|
|
68
68
|
parent[CHILDREN] = [vnode];
|
|
@@ -141,7 +141,7 @@ function renderClassComponent(vnode, context, globalContext) {
|
|
|
141
141
|
export function cleanupVNode(vnode: unknown): void {
|
|
142
142
|
if (afterDiff) afterDiff(vnode);
|
|
143
143
|
vnode[PARENT] = undefined;
|
|
144
|
-
if (
|
|
144
|
+
if (unmountHook) unmountHook(vnode);
|
|
145
145
|
}
|
|
146
146
|
|
|
147
147
|
export function renderComponentVNode(
|
|
@@ -16,6 +16,7 @@ import { flushInitialElementTemplateListUpdates } from '../list/list.js';
|
|
|
16
16
|
import { __page } from '../page/page.js';
|
|
17
17
|
import { __root } from '../page/root-instance.js';
|
|
18
18
|
import { insertElementTemplateSubtree } from '../template/handle.js';
|
|
19
|
+
import { applyPendingMainThreadRefAttachments } from '../template/main-thread-dynamic-attr-state.js';
|
|
19
20
|
import { getElementTemplateNativeRef } from '../template/registry.js';
|
|
20
21
|
import { TYPED_ELEMENT_ATTRIBUTES_SLOT_INDEX } from '../template/typed-attributes.js';
|
|
21
22
|
|
|
@@ -48,6 +49,7 @@ function renderMainThread(): void {
|
|
|
48
49
|
);
|
|
49
50
|
}
|
|
50
51
|
flushInitialListUpdates();
|
|
52
|
+
applyPendingMainThreadRefAttachments();
|
|
51
53
|
} finally {
|
|
52
54
|
profileEnd();
|
|
53
55
|
}
|
|
@@ -11,7 +11,7 @@ import {
|
|
|
11
11
|
runOnBackground,
|
|
12
12
|
} from '../../../core/background-function/run-on-background.js';
|
|
13
13
|
import { resetFunctionCallReturnListener } from '../../../core/thread-function-call/return-value.js';
|
|
14
|
-
import { isRunOnBackgroundEnabled } from '../../../worklet-runtime/jsFunctionLifecycle.js';
|
|
14
|
+
import { JsFunctionLifecycleManager, isRunOnBackgroundEnabled } from '../../../worklet-runtime/jsFunctionLifecycle.js';
|
|
15
15
|
|
|
16
16
|
type BackgroundFunctionCtx = Parameters<typeof registerBackgroundFunctionCtx>[0];
|
|
17
17
|
type RetainableMainThreadCtx = Parameters<typeof retainWorkletCtx>[0];
|
|
@@ -33,6 +33,8 @@ export function registerMainThreadBackgroundFunctionCtx(ctx: MainThreadBackgroun
|
|
|
33
33
|
}
|
|
34
34
|
}
|
|
35
35
|
|
|
36
|
+
// Track the input before Native takes ownership. If Native rejects it, collection
|
|
37
|
+
// must still release its already-registered background execution; slot state commits later.
|
|
36
38
|
export function retainMainThreadBackgroundFunctionCtx(ctx: MainThreadBackgroundFunctionCtx): void {
|
|
37
39
|
retainWorkletCtx(ctx as RetainableMainThreadCtx);
|
|
38
40
|
}
|
|
@@ -43,6 +45,11 @@ export function resetElementTemplateBackgroundFunctionRuntime(): void {
|
|
|
43
45
|
}
|
|
44
46
|
|
|
45
47
|
export function resetElementTemplateMainThreadBackgroundFunctionRuntime(): void {
|
|
48
|
+
const manager = globalThis.lynxWorkletImpl?._jsFunctionLifecycleManager;
|
|
49
|
+
if (manager) {
|
|
50
|
+
manager.dispose();
|
|
51
|
+
globalThis.lynxWorkletImpl._jsFunctionLifecycleManager = new JsFunctionLifecycleManager();
|
|
52
|
+
}
|
|
46
53
|
clearDelayedRunOnBackgroundFunctions();
|
|
47
54
|
resetFunctionCallReturnListener();
|
|
48
55
|
}
|
|
@@ -20,7 +20,16 @@ type MainThreadDynamicAttrStateMap<T> = Map<number, Map<number, T>>;
|
|
|
20
20
|
|
|
21
21
|
const mtEventAttrState: MainThreadDynamicAttrStateMap<MTEventCtx> = new Map();
|
|
22
22
|
const mtRefAttrState: MainThreadDynamicAttrStateMap<MTRefValue> = new Map();
|
|
23
|
-
const
|
|
23
|
+
const attachedMTRefHandleIds = new Set<number>();
|
|
24
|
+
|
|
25
|
+
interface PendingMTRefAttachment {
|
|
26
|
+
handleId: number;
|
|
27
|
+
attrSlotIndex: number;
|
|
28
|
+
value: MTRefValue;
|
|
29
|
+
nativeRef: ElementTemplateHandle;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
let pendingMTRefAttachments: PendingMTRefAttachment[] = [];
|
|
24
33
|
|
|
25
34
|
export interface MainThreadDynamicAttrSubtreeHandle {
|
|
26
35
|
uid: number;
|
|
@@ -63,7 +72,6 @@ function setSlotState<T>(
|
|
|
63
72
|
}
|
|
64
73
|
|
|
65
74
|
function setMTEventSlotState(handleId: number, attrSlotIndex: number, nativeHeldValue: MTEventCtx): void {
|
|
66
|
-
retainMainThreadBackgroundFunctionCtx(nativeHeldValue);
|
|
67
75
|
setSlotState(mtEventAttrState, handleId, attrSlotIndex, nativeHeldValue);
|
|
68
76
|
}
|
|
69
77
|
|
|
@@ -89,6 +97,9 @@ export function prepareMainThreadDynamicAttrSlotsForNative(
|
|
|
89
97
|
}
|
|
90
98
|
let nativeSlots: SerializableValue[] | undefined;
|
|
91
99
|
for (const [attrSlotIndex, kind] of slotKinds) {
|
|
100
|
+
if (kind === 'mt-event' && attributeSlots[attrSlotIndex] != null) {
|
|
101
|
+
retainMainThreadBackgroundFunctionCtx((attributeSlots[attrSlotIndex] as MTEventNativeWrapper).value);
|
|
102
|
+
}
|
|
92
103
|
if (kind !== 'mt-ref') {
|
|
93
104
|
continue;
|
|
94
105
|
}
|
|
@@ -99,14 +110,18 @@ export function prepareMainThreadDynamicAttrSlotsForNative(
|
|
|
99
110
|
}
|
|
100
111
|
|
|
101
112
|
export function clearMainThreadDynamicAttrState(): void {
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
113
|
+
try {
|
|
114
|
+
for (const [handleId, handleState] of mtRefAttrState) {
|
|
115
|
+
if (attachedMTRefHandleIds.has(handleId)) {
|
|
116
|
+
cleanupMTRefHandleState(handleState);
|
|
117
|
+
}
|
|
105
118
|
}
|
|
119
|
+
} finally {
|
|
120
|
+
mtEventAttrState.clear();
|
|
121
|
+
mtRefAttrState.clear();
|
|
122
|
+
attachedMTRefHandleIds.clear();
|
|
123
|
+
pendingMTRefAttachments = [];
|
|
106
124
|
}
|
|
107
|
-
mtEventAttrState.clear();
|
|
108
|
-
mtRefAttrState.clear();
|
|
109
|
-
materializedMTRefHandleIds.clear();
|
|
110
125
|
}
|
|
111
126
|
|
|
112
127
|
export function getMainThreadDynamicAttrState(
|
|
@@ -171,15 +186,15 @@ export function updateMainThreadRefAttrSlot(
|
|
|
171
186
|
isHydration = false,
|
|
172
187
|
): void {
|
|
173
188
|
const previousState = mtRefAttrState.get(handleId)?.get(attrSlotIndex);
|
|
174
|
-
const
|
|
189
|
+
const isAttached = attachedMTRefHandleIds.has(handleId);
|
|
175
190
|
if (value == null) {
|
|
176
|
-
if (previousState &&
|
|
191
|
+
if (previousState && isAttached) {
|
|
177
192
|
cleanupMTRefValue(previousState);
|
|
178
193
|
}
|
|
179
194
|
deleteSlotState(mtRefAttrState, handleId, attrSlotIndex);
|
|
180
195
|
return;
|
|
181
196
|
}
|
|
182
|
-
if (previousState &&
|
|
197
|
+
if (previousState && isAttached) {
|
|
183
198
|
cleanupMTRefValue(previousState);
|
|
184
199
|
}
|
|
185
200
|
const nextValue = (value as MTRefNativeWrapper).value;
|
|
@@ -187,8 +202,8 @@ export function updateMainThreadRefAttrSlot(
|
|
|
187
202
|
if (isHydration) {
|
|
188
203
|
hydrateMTRefValue(nextValue, previousState);
|
|
189
204
|
}
|
|
190
|
-
if (
|
|
191
|
-
|
|
205
|
+
if (isAttached) {
|
|
206
|
+
pendingMTRefAttachments.push({ handleId, attrSlotIndex, value: nextValue, nativeRef });
|
|
192
207
|
}
|
|
193
208
|
}
|
|
194
209
|
|
|
@@ -197,17 +212,32 @@ export function attachMainThreadDynamicAttrRefsForSubtree(
|
|
|
197
212
|
): void {
|
|
198
213
|
for (let handleIndex = 0; handleIndex < handles.length; handleIndex += 1) {
|
|
199
214
|
const handle = handles[handleIndex]!;
|
|
200
|
-
if (
|
|
215
|
+
if (attachedMTRefHandleIds.has(handle.uid)) {
|
|
201
216
|
continue;
|
|
202
217
|
}
|
|
203
|
-
|
|
218
|
+
attachedMTRefHandleIds.add(handle.uid);
|
|
204
219
|
const handleState = mtRefAttrState.get(handle.uid);
|
|
205
220
|
if (!handleState) {
|
|
206
221
|
continue;
|
|
207
222
|
}
|
|
208
|
-
for (const value of handleState
|
|
209
|
-
|
|
223
|
+
for (const [attrSlotIndex, value] of handleState) {
|
|
224
|
+
pendingMTRefAttachments.push({ handleId: handle.uid, attrSlotIndex, value, nativeRef: handle.ref });
|
|
225
|
+
}
|
|
226
|
+
}
|
|
227
|
+
}
|
|
228
|
+
|
|
229
|
+
// Consume one queue snapshot, matching Snapshot's ref delivery boundary.
|
|
230
|
+
export function applyPendingMainThreadRefAttachments(): void {
|
|
231
|
+
const pending = pendingMTRefAttachments;
|
|
232
|
+
pendingMTRefAttachments = [];
|
|
233
|
+
for (const { handleId, attrSlotIndex, value, nativeRef } of pending) {
|
|
234
|
+
const element = __GetElementByAttrSlot(nativeRef, attrSlotIndex);
|
|
235
|
+
if (!element) {
|
|
236
|
+
throw new Error(
|
|
237
|
+
`ElementTemplate main-thread:ref target ${handleId}:${attrSlotIndex} could not be materialized.`,
|
|
238
|
+
);
|
|
210
239
|
}
|
|
240
|
+
attachMTRefValue(value, element);
|
|
211
241
|
}
|
|
212
242
|
}
|
|
213
243
|
|
|
@@ -216,10 +246,10 @@ export function detachMainThreadDynamicAttrRefsForSubtree(
|
|
|
216
246
|
): void {
|
|
217
247
|
for (let handleIndex = 0; handleIndex < handles.length; handleIndex += 1) {
|
|
218
248
|
const handleId = handles[handleIndex]!.uid;
|
|
219
|
-
if (!
|
|
249
|
+
if (!attachedMTRefHandleIds.has(handleId)) {
|
|
220
250
|
continue;
|
|
221
251
|
}
|
|
222
|
-
|
|
252
|
+
attachedMTRefHandleIds.delete(handleId);
|
|
223
253
|
const handleState = mtRefAttrState.get(handleId);
|
|
224
254
|
if (handleState) {
|
|
225
255
|
cleanupMTRefHandleState(handleState);
|
|
@@ -232,10 +262,10 @@ export function deleteMainThreadDynamicAttrStateForSubtree(
|
|
|
232
262
|
): void {
|
|
233
263
|
for (const handleId of handleIds) {
|
|
234
264
|
const handleState = mtRefAttrState.get(handleId);
|
|
235
|
-
if (handleState &&
|
|
265
|
+
if (handleState && attachedMTRefHandleIds.has(handleId)) {
|
|
236
266
|
cleanupMTRefHandleState(handleState);
|
|
237
267
|
}
|
|
238
|
-
|
|
268
|
+
attachedMTRefHandleIds.delete(handleId);
|
|
239
269
|
mtEventAttrState.delete(handleId);
|
|
240
270
|
mtRefAttrState.delete(handleId);
|
|
241
271
|
}
|
|
@@ -41,10 +41,10 @@ export function hydrateMTRefValue(
|
|
|
41
41
|
|
|
42
42
|
export function attachMTRefValue(
|
|
43
43
|
value: MTRefValue,
|
|
44
|
-
nativeRef:
|
|
44
|
+
nativeRef: ElementRef,
|
|
45
45
|
): void {
|
|
46
46
|
if (isMainThreadRef(value)) {
|
|
47
|
-
updateWorkletRef(value, nativeRef
|
|
47
|
+
updateWorkletRef(value, nativeRef);
|
|
48
48
|
return;
|
|
49
49
|
}
|
|
50
50
|
value._unmount = runWorkletCtx(
|
|
@@ -37,6 +37,12 @@ declare global {
|
|
|
37
37
|
// explicit flush options. It is not an Element Template handle.
|
|
38
38
|
function __FlushElementTree(element: undefined, options: FlushOptions): void;
|
|
39
39
|
|
|
40
|
+
// Materializes the instance on demand; parent mounting and layout may still be pending.
|
|
41
|
+
function __GetElementByAttrSlot(
|
|
42
|
+
templateInstance: ElementTemplateHandle,
|
|
43
|
+
attrSlotIndex: number,
|
|
44
|
+
): ElementRef | null;
|
|
45
|
+
|
|
40
46
|
function __CreateElementTemplate(
|
|
41
47
|
templateKey: string,
|
|
42
48
|
bundleUrl: string | null | undefined,
|
package/runtime/src/internal.ts
CHANGED
|
@@ -98,8 +98,8 @@ export const __ComponentIsPolyfill: FC<{ is: string }> = /* @__PURE__ */ factory
|
|
|
98
98
|
export { loadLazyBundle } from './core/lynx/lazy-bundle.js';
|
|
99
99
|
|
|
100
100
|
export { createBackgroundFunctionHandle as transformToWorklet } from './core/background-function/handle.js';
|
|
101
|
-
export { registerWorkletOnBackground } from './snapshot/worklet/hmr.js';
|
|
102
101
|
|
|
102
|
+
export { loadWorkletRuntime } from '@lynx-js/react/worklet-runtime/bindings';
|
|
103
103
|
export { captureMainThreadObject } from './core/capture-main-thread-object.js';
|
|
104
104
|
|
|
105
105
|
if (__DEV__) {
|
package/runtime/src/lynx-api.ts
CHANGED
|
@@ -10,6 +10,7 @@ import { createGlobalProps } from './core/globalProps.js';
|
|
|
10
10
|
import type { GlobalProps } from './core/globalProps.js';
|
|
11
11
|
import { useLynxGlobalEventListener } from './core/hooks/useLynxGlobalEventListener.js';
|
|
12
12
|
import { factory, withInitDataInState } from './core/initData.js';
|
|
13
|
+
import type { DataProcessorDefinition, DataProcessors, InitData, InitDataRaw } from './core/lynx-data-processors.js';
|
|
13
14
|
import { __root } from './root.js';
|
|
14
15
|
import { profileEnd, profileStart } from './shared/profile.js';
|
|
15
16
|
import { LifecycleConstant } from './snapshot/lifecycle/constant.js';
|
|
@@ -338,132 +339,9 @@ export const useGlobalProps: () => GlobalProps = /* @__PURE__ */ _GlobalProps.us
|
|
|
338
339
|
export const useGlobalPropsChanged: (callback: (data: GlobalProps) => void) => void = /* @__PURE__ */ _GlobalProps
|
|
339
340
|
.useChanged();
|
|
340
341
|
|
|
341
|
-
|
|
342
|
-
* The interface you can extends so that the `defaultDataProcessor` parameter can be customized
|
|
343
|
-
*
|
|
344
|
-
* Should be used with `lynx.registerDataProcessors`. See more examples at {@link Lynx.registerDataProcessors}.
|
|
345
|
-
*
|
|
346
|
-
* @public
|
|
347
|
-
*
|
|
348
|
-
* @group Types
|
|
349
|
-
*/
|
|
350
|
-
export interface InitDataRaw {}
|
|
351
|
-
/**
|
|
352
|
-
* The interface you can extends so that the `defaultDataProcessor` returning value can be customized
|
|
353
|
-
*
|
|
354
|
-
* Should be used with `lynx.registerDataProcessors`. See more examples at {@link Lynx.registerDataProcessors}.
|
|
355
|
-
*
|
|
356
|
-
* @public
|
|
357
|
-
*
|
|
358
|
-
* @group Types
|
|
359
|
-
*/
|
|
360
|
-
export interface InitData {}
|
|
361
|
-
|
|
342
|
+
export type { DataProcessorDefinition, DataProcessors, InitData, InitDataRaw };
|
|
362
343
|
export { withInitDataInState };
|
|
363
344
|
|
|
364
|
-
/**
|
|
365
|
-
* The data processors that registered with {@link Lynx.registerDataProcessors}.
|
|
366
|
-
*
|
|
367
|
-
* @example
|
|
368
|
-
*
|
|
369
|
-
* Extending `dataProcessors` interface
|
|
370
|
-
*
|
|
371
|
-
* ```ts
|
|
372
|
-
* import type { DataProcessors as WellKnownDataProcessors } from '@lynx-js/react';
|
|
373
|
-
*
|
|
374
|
-
* declare module '@lynx-js/react' {
|
|
375
|
-
* interface DataProcessors extends WellKnownDataProcessors {
|
|
376
|
-
* foo(bar: string): number;
|
|
377
|
-
* }
|
|
378
|
-
* }
|
|
379
|
-
* ```
|
|
380
|
-
*
|
|
381
|
-
* Then you can use `lynx.registerDataProcessors` with types.
|
|
382
|
-
*
|
|
383
|
-
* ```js
|
|
384
|
-
* lynx.registerDataProcessors({
|
|
385
|
-
* dataProcessors: {
|
|
386
|
-
* foo(bar) {
|
|
387
|
-
* return 1;
|
|
388
|
-
* }
|
|
389
|
-
* }
|
|
390
|
-
* })
|
|
391
|
-
* ```
|
|
392
|
-
*
|
|
393
|
-
* @public
|
|
394
|
-
*
|
|
395
|
-
* @group Types
|
|
396
|
-
*/
|
|
397
|
-
export interface DataProcessors {
|
|
398
|
-
/**
|
|
399
|
-
* Optional processor to override screen metrics used by the app
|
|
400
|
-
*
|
|
401
|
-
* @param metrics - The physical screen dimensions in pixels
|
|
402
|
-
*
|
|
403
|
-
* @returns New screen dimensions to be used by the app
|
|
404
|
-
*
|
|
405
|
-
* @example
|
|
406
|
-
*
|
|
407
|
-
* ```ts
|
|
408
|
-
* lynx.registerDataProcessors({
|
|
409
|
-
* dataProcessors: {
|
|
410
|
-
* getScreenMetricsOverride: (metrics) => {
|
|
411
|
-
* // Force a specific aspect ratio
|
|
412
|
-
* return {
|
|
413
|
-
* width: metrics.width,
|
|
414
|
-
* height: metrics.width * (16/9)
|
|
415
|
-
* };
|
|
416
|
-
* }
|
|
417
|
-
* }
|
|
418
|
-
* });
|
|
419
|
-
* ```
|
|
420
|
-
*/
|
|
421
|
-
getScreenMetricsOverride?(metrics: {
|
|
422
|
-
/**
|
|
423
|
-
* The physical pixel width of the screen
|
|
424
|
-
*/
|
|
425
|
-
width: number;
|
|
426
|
-
/**
|
|
427
|
-
* The physical pixel height of the screen
|
|
428
|
-
*/
|
|
429
|
-
height: number;
|
|
430
|
-
}): { width: number; height: number };
|
|
431
|
-
|
|
432
|
-
/**
|
|
433
|
-
* Custom unknown data processors.
|
|
434
|
-
*
|
|
435
|
-
* @remarks
|
|
436
|
-
*
|
|
437
|
-
* You may extends the `DataProcessors` interface for better TypeScript types. See {@link DataProcessors}.
|
|
438
|
-
*/
|
|
439
|
-
[processorName: string]: (...args: any[]) => any;
|
|
440
|
-
}
|
|
441
|
-
|
|
442
|
-
/**
|
|
443
|
-
* Definition of DataProcessor(s)
|
|
444
|
-
* @public
|
|
445
|
-
*
|
|
446
|
-
* @group Types
|
|
447
|
-
*/
|
|
448
|
-
export interface DataProcessorDefinition {
|
|
449
|
-
/**
|
|
450
|
-
* You can custom input and output type of `defaultDataProcessor` by extends {@link InitDataRaw} and {@link InitData}
|
|
451
|
-
*
|
|
452
|
-
* Should be used with `lynx.registerDataProcessors`. See more examples at {@link Lynx.registerDataProcessors}.
|
|
453
|
-
*
|
|
454
|
-
* @param rawInitData - initData passed from native code
|
|
455
|
-
* @returns
|
|
456
|
-
* @public
|
|
457
|
-
*/
|
|
458
|
-
defaultDataProcessor?: (rawInitData: InitDataRaw) => InitData;
|
|
459
|
-
/**
|
|
460
|
-
* Should be used with `lynx.registerDataProcessors`. See more examples at {@link Lynx.registerDataProcessors}.
|
|
461
|
-
*
|
|
462
|
-
* @public
|
|
463
|
-
*/
|
|
464
|
-
dataProcessors?: DataProcessors;
|
|
465
|
-
}
|
|
466
|
-
|
|
467
345
|
/**
|
|
468
346
|
* APIs under `lynx` global variable that added by ReactLynx.
|
|
469
347
|
*
|