@meld-ts/core
    Preparing search index...

    Variable pendingFnConst

    pendingFn: PendingHandle["pendingFn"] = _defaultPending.pendingFn

    感知 pending 状态的 inflight 去重(全局实例)

    fn 的第一个参数为 PendingFnParams,包含 scope 和 getPendingCount, 允许根据 pending 状态做自定义处理(如短路检查、日志等)。 返回的函数剥掉 PendingFnParams,只暴露业务参数。

    全局实例注意:静态 scope 必须在整个应用内唯一。HMR 场景下请改用 createPending 创建模块级独立实例。

    静态 scope 字符串,或基于参数动态生成 scope 的函数

    接收 PendingFnParams 的回调函数

    只保留业务参数的包装函数

    const mountScript = pendingFn(
    (url: string) => `script:${url}`,
    ({ scope, getPendingCount }, url: string) => {
    const existing = document.getElementById(scope);
    if (existing) return { element: existing };
    return loadScript(url);
    },
    );

    await Promise.all([mountScript('/lib.js'), mountScript('/lib.js')]);