You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Webview is a wrapper for 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
for Nim than oskca's bindings, which were last
updated 5 years ago and are severely out of date.
Binding Features
Similar to 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:<dll-name>.
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:<lib-name>.
Examples can be found at 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 in the structure described
here.
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:
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
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 and
WebKitGTK are required for both development and distribution.
See here.