推荐页 ready 持续观察运行态图片、背景、音视频和资源 pending 标记 资源换签与玩法图集解析中通过隐藏标记阻止遮罩提前消失 补齐拼图、跳一跳、抓大鹅和敲木鱼运行态资源等待接入 补充推荐页资源等待回归测试和团队文档
30 lines
651 B
TypeScript
30 lines
651 B
TypeScript
type RuntimeResourcePendingMarkerProps = {
|
|
source?: string | null;
|
|
isPending?: boolean;
|
|
kind?: string;
|
|
};
|
|
|
|
export const RUNTIME_RESOURCE_PENDING_SELECTOR =
|
|
'[data-runtime-resource-pending="true"]';
|
|
|
|
export function RuntimeResourcePendingMarker({
|
|
source,
|
|
isPending = true,
|
|
kind,
|
|
}: RuntimeResourcePendingMarkerProps) {
|
|
const normalizedSource = source?.trim() ?? '';
|
|
if (!isPending || !normalizedSource) {
|
|
return null;
|
|
}
|
|
|
|
return (
|
|
<span
|
|
hidden
|
|
aria-hidden="true"
|
|
data-runtime-resource-pending="true"
|
|
data-runtime-resource-src={normalizedSource}
|
|
data-runtime-resource-kind={kind}
|
|
/>
|
|
);
|
|
}
|