Protocol

external interface Protocol(source)

Functions

Link copied to clipboard
abstract fun handle(scheme: String, handler: (GlobalRequest) -> Any)

Register a protocol handler for scheme. Requests made to URLs with this scheme will delegate to this handler to determine what response should be sent.

Link copied to clipboard
abstract fun interceptBufferProtocol(scheme: String, handler: (request: ProtocolRequest, callback: (response: Any) -> Unit) -> Unit): Boolean

Whether the protocol was successfully intercepted

Link copied to clipboard
abstract fun interceptFileProtocol(scheme: String, handler: (request: ProtocolRequest, callback: (response: Any) -> Unit) -> Unit): Boolean

Whether the protocol was successfully intercepted

Link copied to clipboard
abstract fun interceptHttpProtocol(scheme: String, handler: (request: ProtocolRequest, callback: (response: ProtocolResponse) -> Unit) -> Unit): Boolean

Whether the protocol was successfully intercepted

Link copied to clipboard
abstract fun interceptStreamProtocol(scheme: String, handler: (request: ProtocolRequest, callback: (response: Any) -> Unit) -> Unit): Boolean

Whether the protocol was successfully intercepted

Link copied to clipboard
abstract fun interceptStringProtocol(scheme: String, handler: (request: ProtocolRequest, callback: (response: Any) -> Unit) -> Unit): Boolean

Whether the protocol was successfully intercepted

Link copied to clipboard
abstract fun isProtocolHandled(scheme: String): Boolean

Whether scheme is already handled.

Link copied to clipboard
abstract fun isProtocolIntercepted(scheme: String): Boolean

Whether scheme is already intercepted.

Link copied to clipboard
abstract fun isProtocolRegistered(scheme: String): Boolean

Whether scheme is already registered.

Link copied to clipboard
abstract fun registerBufferProtocol(scheme: String, handler: (request: ProtocolRequest, callback: (response: Any) -> Unit) -> Unit): Boolean

Whether the protocol was successfully registered

Link copied to clipboard
abstract fun registerFileProtocol(scheme: String, handler: (request: ProtocolRequest, callback: (response: Any) -> Unit) -> Unit): Boolean

Whether the protocol was successfully registered

Link copied to clipboard
abstract fun registerHttpProtocol(scheme: String, handler: (request: ProtocolRequest, callback: (response: ProtocolResponse) -> Unit) -> Unit): Boolean

Whether the protocol was successfully registered

Link copied to clipboard

Registers the scheme as standard, secure, bypasses content security policy for resources, allows registering ServiceWorker, supports fetch API, streaming video/audio, and V8 code cache. Specify a privilege with the value of true to enable the capability.

Link copied to clipboard
abstract fun registerStreamProtocol(scheme: String, handler: (request: ProtocolRequest, callback: (response: Any) -> Unit) -> Unit): Boolean

Whether the protocol was successfully registered

Link copied to clipboard
abstract fun registerStringProtocol(scheme: String, handler: (request: ProtocolRequest, callback: (response: Any) -> Unit) -> Unit): Boolean

Whether the protocol was successfully registered

Link copied to clipboard
abstract fun unhandle(scheme: String)

Removes a protocol handler registered with protocol.handle.

Link copied to clipboard
abstract fun uninterceptProtocol(scheme: String): Boolean

Whether the protocol was successfully unintercepted

Link copied to clipboard
abstract fun unregisterProtocol(scheme: String): Boolean

Whether the protocol was successfully unregistered