For AI agents: the complete documentation index is available at /zh/llms.txt, the full documentation bundle is available at /zh/llms-full.txt, and this page is available as Markdown at /zh/lynxtron/api/@lynx-js/lynxtron/Interface.Protocol.md.
  • 简体中文
  • @lynx-js/lynxtron / Protocol

    Protocol

    方法

    handle()

    handle(scheme: string, handler: ProtocolHandler): void

    Register a resource handler for a URL scheme such as app.

    Returning false or undefined falls back to the normal Lynx resource loading path. Return a Promise when the response data is produced asynchronously.

    参数

    范围类型
    schemestring
    handlerProtocolHandler

    返回

    void

    定义于

    apis/api/protocol.d.ts:38


    isProtocolHandled()

    isProtocolHandled(scheme: string): boolean

    Whether a handler is registered for scheme.

    参数

    范围类型
    schemestring

    返回

    boolean

    定义于

    apis/api/protocol.d.ts:42


    setRequestRewriter()

    setRequestRewriter(handler: undefined | null | ProtocolRequestRewriter): void

    Rewrite a resource request URL before protocol handlers and fallback loaders run. Pass null or undefined to clear the current rewriter.

    参数

    范围类型
    handlerundefined | null | ProtocolRequestRewriter

    返回

    void

    定义于

    apis/api/protocol.d.ts:51


    unhandle()

    unhandle(scheme: string): void

    Remove the handler registered for scheme.

    参数

    范围类型
    schemestring

    返回

    void

    定义于

    apis/api/protocol.d.ts:46

    除非另有说明,本项目采用知识共享署名 4.0 国际许可协议进行许可,代码示例采用 Apache License 2.0 许可协议进行许可。