https://github.com/neroist/webview
Updated bindings for Webview for Nim.
https://github.com/neroist/webview
binding nim nim-lang webview
Last synced: 3 months ago
JSON representation
Updated bindings for Webview for Nim.
- Host: GitHub
- URL: https://github.com/neroist/webview
- Owner: neroist
- License: mit
- Created: 2023-03-09T12:28:14.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2024-09-15T02:08:01.000Z (about 1 year ago)
- Last Synced: 2025-05-03T02:59:22.751Z (7 months ago)
- Topics: binding, nim, nim-lang, webview
- Language: Nim
- Homepage: https://neroist.github.io/webview/
- Size: 344 KB
- Stars: 38
- Watchers: 4
- Forks: 0
- Open Issues: 3
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- awesome-nim - webview - Nim bindings and wrapper for Webview. (User Interface / GUI)
README
# Webview
Webview is a wrapper for [Webview](https://github.com/webview/webview), a tiny
cross-platform webview library for C/C++ to build modern cross-platform GUIs.
Webview (the wrapper) supports two-way JavaScript bindings, to call JavaScript from
Nim and to call Nim from JavaScript.
Webview is also an updated wrapper for [Webview](https://github.com/webview/webview)
for Nim than [oskca's bindings](https://github.com/oskca/webview), which were last
updated 5 years ago and are severely out of date.
## Binding Features
Similar to [`uing`](https://github.com/neroist/uing), you can also choose to
whether or not compile with a DLL, static library, or to statically compile Webview
sources into your executable.
To compile with a DLL, pass `-d:useWebviewDll` to the Nim compiler. You can also
choose the name/path of the DLL with `-d:webviewDll:`.
To compile with a static library, compile with `-d:useWebviewStaticLib` or
`-d:useWebviewStaticLibrary`. Similarly, you can also
choose the name/path of the static library with `-d:webviewStaticLibrary:`.
## Documentation
Documentation is available at
### Examples
Examples can be found at [`examples/`](examples/). Currently, it contains two
examples, `basic.nim`, a basic example of Webview, and `bind.nim`, an example of
calling Nim from Javascript with Webview. In addition, it also has an [example
application](examples/example_application) in the structure described
[here](https://github.com/webview/webview#app-distribution).
Here's [`basic.nim`](examples/basic.nim) for you:
```nim
import webview
let w = newWebview() # or you can use create()
w.title = "Basic Example" # or use setTitle()
w.size = (480, 320) # or setSize()
w.html = "Thanks for using webview!" # or setHtml()
w.run()
w.destroy()
```
## Installation
Install via Nimble:
```shell
nimble install https://github.com/neroist/webview
```
This package isn't in Nimble's package list, so you have to install via GitHub link.
## Requirements
On Windows, Webview requires that developers and end-users must have the
[WebView2 runtime](https://developer.microsoft.com/en-us/microsoft-edge/webview2/)
installed on their system for any version of Windows before Windows 11. The
WebView2 SDK is installed for you, so no need to worry about that.
On Linux and BSD, Only [GTK3](https://docs.gtk.org/gtk3/) and
[WebKitGTK](https://webkitgtk.org/) are required for both development and distribution.
See [here](https://github.com/webview/webview#linux-and-bsd).
## Distribution
See [here](https://github.com/webview/webview#app-distribution) in Webview's README.