🔥码云GVP开源项目 12k star Uniapp+ElementUI 功能强大 支持多语言、二开方便! 广告
# WebAsyncWrapper WebClient和WebRequest包装类,用于启用回调式异步请求 *注意* 仅限Windows且仅限Excel,需要引用“Microsoft WinHTTP Services, version 5.1” 用法: ~~~vb '// Module: Handler Public Sub Simple(Response As WebResponse) '// ... End Sub Public Sub WithArgs(Response As WebResponse, Args As Variant) '// ... End Sub Dim Client As New WebClient Client.BaseUrl = "https://api.example.com/v1/" '// 包装类需要客户端执行请求 Dim Wrapper As New WebAsyncWrapper Set Wrapper.Client = Client Dim Request As New WebRequest Request.Resource = "messages" Wrapper.ExecuteAsync Request, "Handler.Simple" '// -> Simple called later with response '// 如果需要将状态传递给回调,请使用CallbackArgs Dim Args As Variant Args = Array("abc", 123) Wrapper.ExecuteAsync Request, "Handler.WithArgs", Args '// -> WithArgs called later with response and args ~~~