- protocol·续1
- protocol.isProtocolHandled(scheme)
- protocol.interceptFileProtocol(scheme, handler[, completion])
- protocol.interceptStringProtocol(scheme, handler[, completion])
- protocol.interceptBufferProtocol(scheme, handler[, completion])
- protocol.interceptHttpProtocol(scheme, handler[, completion])
- protocol.interceptStreamProtocol(scheme, handler[, completion])
- protocol.uninterceptProtocol(scheme[, completion])
protocol·续1
-
completion Function (optional)
-
error Error
取消对自定义scheme的注册
protocol.isProtocolHandled(scheme)
- scheme String
Returns Promise<Boolean> - fulfilled with a boolean that indicates whether there is already a handler for scheme.
protocol.interceptFileProtocol(scheme, handler[, completion])
-
scheme String
-
handler Function
-
request Object
-
url String
-
headers Record
-
referrer String
-
method String
-
uploadData UploadData[]
-
callback Function
-
filePath String
-
completion Function (optional)
-
error Error
终止 scheme 协议, 并将 handler 作为该protocol新的处理方式,即返回一个file。
protocol.interceptStringProtocol(scheme, handler[, completion])
-
scheme String
-
handler Function
-
request Object
-
url String
-
headers Record
-
referrer String
-
method String
-
uploadData UploadData[]
-
callback Function
-
data (String | StringProtocolResponse) (optional)
-
completion Function (optional)
-
error Error
终止 scheme 协议, 并将 handler 作为该protocol新的处理方式,即返回一个String。
protocol.interceptBufferProtocol(scheme, handler[, completion])
-
scheme String
-
handler Function
-
request Object
-
url String
-
headers Record
-
referrer String
-
method String
-
uploadData UploadData[]
-
callback Function
-
buffer Buffer (可选)
-
completion Function (optional)
-
error Error
终止 scheme 协议, 并将 handler 作为该protocol新的处理方式,即返回一个Buffer。
protocol.interceptHttpProtocol(scheme, handler[, completion])
-
scheme String
-
handler Function
-
request Object
-
url String
-
headers Record
-
referrer String
-
method String
-
uploadData UploadData[]
-
callback Function
-
redirectRequest Object
-
url String
-
method String (optional)
-
session Session | null (optional)
-
uploadData ProtocolResponseUploadData (optional)
-
completion Function (optional)
-
error Error
终止 scheme 协议, 并将 handler 作为该protocol新的处理方式,即返回一个新 HTTP 请求。
protocol.interceptStreamProtocol(scheme, handler[, completion])
-
scheme String
-
handler Function
-
request Object
-
url String
-
headers Record
-
referrer String
-
method String
-
uploadData UploadData[]
-
callback Function
-
stream (ReadableStream | StreamProtocolResponse) (可选)
-
completion Function (optional)
-
error Error
它与 registerStreamProtocol方法相同, 不过它是用来替换现有的protocol处理方式。
protocol.uninterceptProtocol(scheme[, completion])
-
scheme String
-
completion Function (optional)
-
error Error
移除为 scheme 安装的拦截器,并还原其原始处理方式。
