PWA

class PWA(cdp: CDP) : Domain

This domain allows interacting with the browser to control PWAs.

Constructors

Link copied to clipboard
constructor(cdp: CDP)

Types

Link copied to clipboard
@Serializable
data class ChangeAppUserSettingsParameter(val manifestId: String, val linkCapturing: Boolean? = null, val displayMode: PWA.DisplayMode? = null)
Link copied to clipboard
@Serializable
enum DisplayMode : Enum<PWA.DisplayMode>

If user prefers opening the app in browser or an app window.

Link copied to clipboard
@Serializable
data class FileHandler(val action: String, val accepts: List<PWA.FileHandlerAccept>, val displayName: String)
Link copied to clipboard
@Serializable
data class FileHandlerAccept(val mediaType: String, val fileExtensions: List<String>)

The following types are the replica of https://crsrc.org/c/chrome/browser/web_applications/proto/web_app_os_integration_state.proto;drc=9910d3be894c8f142c977ba1023f30a656bc13fc;l=67

Link copied to clipboard
@Serializable
data class GetOsAppStateParameter(val manifestId: String)
Link copied to clipboard
@Serializable
data class GetOsAppStateReturn(val badgeCount: Int, val fileHandlers: List<PWA.FileHandler>)
Link copied to clipboard
@Serializable
data class InstallParameter(val manifestId: String, val installUrlOrBundleUrl: String? = null)
Link copied to clipboard
@Serializable
data class LaunchFilesInAppParameter(val manifestId: String, val files: List<String>)
Link copied to clipboard
@Serializable
data class LaunchFilesInAppReturn(val targetIds: List<String>)
Link copied to clipboard
@Serializable
data class LaunchParameter(val manifestId: String, val url: String? = null)
Link copied to clipboard
@Serializable
data class LaunchReturn(val targetId: String)
Link copied to clipboard
@Serializable
data class OpenCurrentPageInAppParameter(val manifestId: String)
Link copied to clipboard
@Serializable
data class UninstallParameter(val manifestId: String)

Functions

Link copied to clipboard
suspend fun changeAppUserSettings(args: PWA.ChangeAppUserSettingsParameter, mode: CommandMode = CommandMode.DEFAULT)
suspend fun changeAppUserSettings(manifestId: String, linkCapturing: Boolean? = null, displayMode: PWA.DisplayMode? = null)

Changes user settings of the web app identified by its manifestId. If the app was not installed, this command returns an error. Unset parameters will be ignored; unrecognized values will cause an error.

Link copied to clipboard
suspend fun getOsAppState(manifestId: String): PWA.GetOsAppStateReturn
suspend fun getOsAppState(args: PWA.GetOsAppStateParameter, mode: CommandMode = CommandMode.DEFAULT): PWA.GetOsAppStateReturn

Returns the following OS state for the given manifest id.

Link copied to clipboard
suspend fun install(args: PWA.InstallParameter, mode: CommandMode = CommandMode.DEFAULT)
suspend fun install(manifestId: String, installUrlOrBundleUrl: String? = null)

Installs the given manifest identity, optionally using the given installUrlOrBundleUrl

Link copied to clipboard
suspend fun launch(args: PWA.LaunchParameter, mode: CommandMode = CommandMode.DEFAULT): PWA.LaunchReturn
suspend fun launch(manifestId: String, url: String? = null): PWA.LaunchReturn

Launches the installed web app, or an url in the same web app instead of the default start url if it is provided. Returns a page Target.TargetID which can be used to attach to via Target.attachToTarget or similar APIs.

Link copied to clipboard
suspend fun launchFilesInApp(manifestId: String, files: List<String>): PWA.LaunchFilesInAppReturn

Opens one or more local files from an installed web app identified by its manifestId. The web app needs to have file handlers registered to process the files. The API returns one or more page Target.TargetIDs which can be used to attach to via Target.attachToTarget or similar APIs. If some files in the parameters cannot be handled by the web app, they will be ignored. If none of the files can be handled, this API returns an error. If no files are provided as the parameter, this API also returns an error.

Link copied to clipboard
suspend fun openCurrentPageInApp(manifestId: String)
suspend fun openCurrentPageInApp(args: PWA.OpenCurrentPageInAppParameter, mode: CommandMode = CommandMode.DEFAULT)

Opens the current page in its web app identified by the manifest id, needs to be called on a page target. This function returns immediately without waiting for the app to finish loading.

Link copied to clipboard
suspend fun uninstall(manifestId: String)
suspend fun uninstall(args: PWA.UninstallParameter, mode: CommandMode = CommandMode.DEFAULT)

Uninstalls the given manifest_id and closes any opened app windows.