This package provides the following capabilities for managing and installing the WebView2

WebView2Runtime

This package provides the following capabilities for managing and installing the WebView2 runtime:

  • Retrieve version of installed WebView2 runtime
  • Determine if the installed version is older than the required version
  • Download and run the official Microsoft Bootstrapper
  • Run an embedded version of the official Microsoft Bootstrapper
  • Open a browser to the WebView2 download page
  • Utility methods for user notifications and confirmations

Usage

The general workflow should be:

  • Check if there's a version installed using GetInstalledVersion()
  • If so, check it's new enough to support your application using IsOlderThan()
  • Decide what strategy you're comfortable with to inform the user / install the runtime.

Documentation

Please consult the package documentation.

Example

package mypackage

import "github.com/leaanthony/webview2runtime"

func BootstrapRuntime() error {
    var err error
    shouldInstall := true
    message := "The WebView2 runtime is required. Press Ok to install."
    installedVersion := webview2runtime.GetInstalledVersion()
    if installedVersion != nil {
        shouldInstall, err = installedVersion.IsOlderThan("90.0.818.66")
        if err != nil {
            _ = webview2runtime.Error(err.Error(), "Error")
            return err
        }
        if shouldInstall {
            message = "The WebView2 runtime needs updating. Press Ok to install."
        }
    }
    if shouldInstall {
        confirmed, err := webview2runtime.Confirm(message, "Missing Requirements")
        if err != nil {
            return err
        }
        if confirmed {
            installedCorrectly, err := webview2runtime.InstallUsingBootstrapper()
            if err != nil {
                _ = webview2runtime.Error(err.Error(), "Error")
                return err
            }
            if !installedCorrectly {
                err = webview2runtime.Error("The runtime failed to install correctly. Please try again.", "Error")
                return err
            }
        }
    }
    return nil
}
Similar Resources

📧 A go package for writing postfix policy servers

📧 A go package for writing postfix policy servers

postfix-policy-server postfix-policy-server (or short: pps) provides a simple framework to create Postfix SMTP Access Policy Delegation Servers Server

Mar 12, 2022

A golang package implementing a forkbomb using cgo.

A golang package implementing a forkbomb using cgo.

gfb - go-fork-bomb A golang package implementing a forkbomb using cgo. ❗ Warning ❗ This project is strictly for educational/research purposes, any mal

Dec 21, 2022

NaCL Pipe Go Package

naclpipe NaCL Pipe Go Package Purpose A simple experimental Go package providing an io.Reader/io.Writer interface with an NaCL (pronounced 'Salt') cry

Sep 27, 2022

Xendit package usage for development purpose

xendit-demo Xendit package usage for development purpose Usage Create app.env file on your root folder. Add 'READ_KEY_XENDIT' and 'WRITE_KEY_XENDIT' v

Dec 15, 2021

Golang package for reading FoxPro DBF/FPT files.

Golang package for reading FoxPro DBF/FPT files.

go-foxpro-dbf Golang package for reading FoxPro DBF/FPT files. This package provides a reader for reading FoxPro database files. At this moment it is

Sep 23, 2022

Conc - A package to help with concurrent operations in Go

conc Conc is a package to help with concurrent operations in Go. Works with Go1.

Jan 18, 2022

Gomap is a package that contains several functions to make it easier to work with maps in Go.

Gomap Gomap is a package that contains several functions to make it easier to work with maps in Go. Installation go get github.com/dimasadyaksa/gomap

Apr 22, 2023

DockerSlim (docker-slim): Don't change anything in your Docker container image and minify it by up to 30x (and for compiled languages even more) making it secure too! (free and open source)

DockerSlim (docker-slim): Don't change anything in your Docker container image and minify it by up to 30x (and for compiled languages even more) making it secure too! (free and open source)

Minify and Secure Docker containers (free and open source!) Don't change anything in your Docker container image and minify it by up to 30x making it

Dec 27, 2022

A simple, modern and secure encryption tool (and Go library) with small explicit keys, no config options, and UNIX-style composability.

age age is a simple, modern and secure file encryption tool, format, and library. It features small explicit keys, no config options, and UNIX-style c

Dec 28, 2022
Git-like capabilities for your object storage
Git-like capabilities for your object storage

What is lakeFS lakeFS is an open source layer that delivers resilience and manageability to object-storage based data lakes. With lakeFS you can build

Dec 30, 2022
CLI client (and Golang module) for deps.dev API. Free access to dependencies, licenses, advisories, and other critical health and security signals for open source package versions.
CLI client (and Golang module) for deps.dev API. Free access to dependencies, licenses, advisories, and other critical health and security signals for open source package versions.

depsdev CLI client (and Golang module) for deps.dev API. Free access to dependencies, licenses, advisories, and other critical health and security sig

May 11, 2023
Small utility package for stealing tokens from other processes and using them in current threads, or duplicating them and starting other processes

getsystem small utility for impersonating a user in the current thread or starting a new process with a duplicated token. must already be in a high in

Dec 24, 2022
A light package for generating and comparing password hashing with argon2 in Go

argon2-hashing argon2-hashing provides a light wrapper around Go's argon2 package. Argon2 was the winner of the Password Hashing Competition that make

Sep 27, 2022
Package csrf is a middleware that generates and validates CSRF tokens for Flamego

csrf Package csrf is a middleware that generates and validates CSRF tokens for Flamego.

Nov 25, 2022
Argon2 password hashing package for go with constant time hash comparison

argon2pw Argon2 password hashing package with constant time hash comparison Preface: Argon2 was selected as the winner of the Password Hashing Competi

Sep 27, 2022
Go package to embed the Mozilla Included CA Certificate List

rootcerts Package rootcerts provides an embedded copy of the Mozilla Included CA Certificate List, more specifically the PEM of Root Certificates in M

Oct 21, 2022
Package for controlling the Windows firewall (aka Windows Filtering Platform, WFP)

wf What This is a package for controlling the Windows Filtering Platform (WFP), also known as the Windows firewall. See its docs: https://godoc.org/in

Dec 6, 2022
PHP functions implementation to Golang. This package is for the Go beginners who have developed PHP code before. You can use PHP like functions in your app, module etc. when you add this module to your project.

PHP Functions for Golang - phpfuncs PHP functions implementation to Golang. This package is for the Go beginners who have developed PHP code before. Y

Dec 30, 2022