Current section

Files

Jump to
Raw

README.md

# webview_elixir

A module for interacting with a single-instance WebView in Elixir. It is implemented as
a set of bindings for the [webview](https://github.com/webview/webview) library. 
It enables access to webview functionality from within Elixir.


## Installation

If [available in Hex](https://hex.pm/docs/publish), the package can be installed
by adding `webview_elixir` to your list of dependencies in `mix.exs`:

```elixir
def deps do
  [
    {:webview_elixir, "~> 0.1.1"}
  ]
end
```

Documentation can be generated with [ExDoc](https://github.com/elixir-lang/ex_doc)
and published on [HexDocs](https://hexdocs.pm). Once published, the docs can
be found at <https://hexdocs.pm/webview_elixir>.

Depending on the system, the following dependencies must be installed in order
to compile the webview NIF code:

Ubuntu
```
make pkg-config libwebkitgtk-6.0-dev libgtk-4-dev g++ gcc
```

Darwin
```
clang make
```

Windows
```
mingw-w64-gcc (MSYS2)
```
Add the MS WebView2.h header from [Nuget](https://www.nuget.org/packages/Microsoft.Web.WebView2)
into the c_src/include directory.


## Getting Started

```
WebView.create()
WebView.set_title(~c"App Window")
WebView.set_size(800, 600, WebView.Hint.none)
WebView.set_html(~c"<p>Example Webview</p>")
WebView.run()
WebView.destroy()
```

## License

Apache-2.0, MIT