Protocol

external interface Protocol(source)

Functions

Link copied to clipboard
abstract external 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 external fun interceptBufferProtocol(scheme: String, handler: (request: ProtocolRequest, callback: (response: Any) -> Unit) -> Unit): Boolean

Whether the protocol was successfully intercepted

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

Whether the protocol was successfully intercepted

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

Whether the protocol was successfully intercepted

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

Whether the protocol was successfully intercepted

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

Whether the protocol was successfully intercepted

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

Whether scheme is already handled.

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

Whether scheme is already intercepted.

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

Whether scheme is already registered.

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

Whether the protocol was successfully registered

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

Whether the protocol was successfully registered

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

Whether the protocol was successfully registered

Link copied to clipboard
abstract external fun registerSchemesAsPrivileged(customSchemes: ReadonlyArray<CustomScheme>)

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 external fun registerStreamProtocol(scheme: String, handler: (request: ProtocolRequest, callback: (response: Any) -> Unit) -> Unit): Boolean

Whether the protocol was successfully registered

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

Whether the protocol was successfully registered

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

Removes a protocol handler registered with protocol.handle.

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

Whether the protocol was successfully unintercepted

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

Whether the protocol was successfully unregistered