A Node.js binding to webview

Overview

webview-nodejs

npm npm bundle size (version) npm last commit license npm type definitions

English | 中文(简体)

A Node.js binding to webview, a tiny cross-platform webview library to build modern cross-platform desktop GUIs using WebView2, WebKit and WebKitGTK.

Getting Started

  1. Install via npm
npm i webview-nodejs
  1. Import and use webview
const {Webview} = require('webview-nodejs');

let w = new Webview();
w.title("Hello");
w.size(600,600);
w.navigate("https://example.com");
w.dispatch(()=>{
    w.title("World")
});
w.bind("increment", (w,arg1,arg2)=>{
    w.title(arg1);
    return arg1+arg2;
});
w.show();

Help

Supported Platforms

Build-in support:

  • win32 x64
  • linux x64
  • osx x64
  • osx aarch64

By loading lib manully, other architectures could be supported. osx is not tested.

Contribution

All suggestions, pull requests, issues and other contributions are welcome and appreciated.

Credits

Project License
webview MIT
webview_deno MIT
node-ffi-napi MIT
Microsoft Webview2 Microsoft WebView2 License

License

Copyright 2022 Winterreisender.

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and limitations under the License.

SPDX short identifier: Apache-2.0

You might also like...

Apilytics for Node.js - Easy API analytics for Node backends

apilytics-node Apilytics is a service that lets you analyze operational, performance and security metrics from your APIs without infrastructure-level

Sep 2, 2022

This is a vanilla Node.js rest API created to show that it is possible to create a rest API using only vanilla Node.js

This is a vanilla Node.js rest API created to show that it is possible to create a rest API using only vanilla Node.js. But in most cases, I would recommend you to use something like Express in a production project for productivity purposes.

Jul 19, 2022

Inter Process Communication Module for node supporting Unix sockets, TCP, TLS, and UDP. Giving lightning speed on Linux, Mac, and Windows. Neural Networking in Node.JS

Inter Process Communication Module for node supporting Unix sockets, TCP, TLS, and UDP. Giving lightning speed on Linux, Mac, and Windows. Neural Networking in Node.JS

Inter Process Communication Module for node supporting Unix sockets, TCP, TLS, and UDP. Giving lightning speed on Linux, Mac, and Windows. Neural Networking in Node.JS

Dec 9, 2022

Node js package makes creating node jd dependincies files like Controllers,Entities and Repositories easier by executing a few instructions

Node js package makes creating node jd dependincies files like Controllers,Entities and Repositories easier by executing a few instructions

Nodejs Studio Node js package makes creating node js project dependincies files like Controllers,Entities and Repositories easier by executing a few i

Oct 12, 2022

Spin node create spin api for node

Links Contract api JS api @spinfi/core @spinfi/node @spinfi/node Spin node create spin api for node How to install yarn add @spinfi/node How to init i

Oct 18, 2022

:white_check_mark: The Node.js best practices list (March 2021)

:white_check_mark:  The Node.js best practices list (March 2021)

Node.js Best Practices Follow us on Twitter! @nodepractices Read in a different language: CN, BR, RU, PL, JA, EU (ES, FR, HE, KR and TR in progress! )

Jan 9, 2023

A new Node.js resource built using Gatsby.js with React.js, TypeScript, and Remark.

Nodejs.dev Nodejs.dev site built using Gatsby.js with React.js, TypeScript, SCSS, and Remark. You can find the latest Figma design protype here. 🚀 Ge

Jan 5, 2023

📗 How to write cross-platform Node.js code

📗 How to write cross-platform Node.js code

How to write cross-platform Node.js code. Why you should care: according to the 2018 Node.js user survey, 24% of Node.js developers use Windows locall

Jan 3, 2023

Mina Node Monitor

Mina Node Monitor

Mina Node Monitor Mina Monitor is an extended graphical version of the mina client status command with additional indicators. This is a client-server

Dec 18, 2022
Comments
  • example with keybinding and log

    example with keybinding and log

    Hi,

    thanks for the nodejs bindings, much appreciated!

    Because it wasn't completely obvious for me I created an example with keybindings (which are platform specific, this is for a Mac) and logging.

    Maybe this is helpful for someone.

    const { Webview } = require("webview-nodejs");
    
    html = `
    <body>
      <div id="d1"></div>
      <script>
        let counter = 0
        window.addEventListener("keypress", (event) => {
          if (event.metaKey && event.key === 'q') {
            doCmd("quit")
            event.preventDefault();
          }
        })
    
        setInterval(function () {
          document.querySelector("#d1").innerText = counter
          doLog("counter is " + counter)
          counter += 1
        }, 1000);
      </script>
    </body>
    `
    
    let w = new Webview(true);
    
    w.size(600, 600);
    w.html(html);
    
    w.bind("doLog", (w, t) => {
      console.log(t);
      w.title(t)
    });
    
    w.bind("doCmd", (w, cmd) => {
      console.log("cmd:", cmd);
      if (cmd == "quit") w.terminate();
    });
    
    w.show();
    
    documentation 
    opened by dirkk0 3
  • Improvements to bind method

    Improvements to bind method

    • Allows passing handlers to bind without explicit return values (otherwise JSON.stringify fails on implicit undefined)
    • Reports instances where JSON.stringify cannot serialize a return value
    • Converts errors to meaningful strings, rather than "[object Object]"
    opened by averynortonsmith 1
  • Add license scan report and status

    Add license scan report and status

    Your FOSSA integration was successful! Attached in this PR is a badge and license report to track scan status in your README.

    Below are docs for integrating FOSSA license checks into your CI:

    opened by fossabot 0
Releases(v0.1.3)
Owner
Winterreisender
A C/C++ and Kotlin/Java amateur.
Winterreisender
macOS Internal Webview App SourceCode

macOS Internal Webview App SourceCode Read First Inspecting Web Views in macOS System Preferences Family Sharing wget https://setup.icloud.com/resourc

不郑 4 Mar 7, 2022
The universal DevTools for LIFF (WebView) browser

LIFF Inspector ?? The universal DevTools for LIFF (WebView) browser LIFF Inspector is the official DevTools for LIFF(LNE Frontend Framework) that is i

LINE 34 Dec 19, 2022
Sample apps showing how to build music and video apps for Xbox using a WebView.

description languages name page_type products urlFragment Sample showing how to build music and video apps using primarily web technologies for Xbox.

Microsoft 11 Dec 14, 2022
Webview is a tiny cross-platform library to make web-based GUIs for desktop applications.

webview_deno deno bindings for webview Webview is a tiny cross-platform library to make web-based GUIs for desktop applications. ⚠️ This project is st

webview 1.2k Jan 2, 2023
A MagicMirror² module which embeds multiple other websites with iframe or webview

MMM-EmbedURL This is a MagicMirror² module which embeds other websites either by "iframe" (default), "webview" or a custom HTML-element to your mirror

Thomas Hirschberger 6 Dec 18, 2022
A data-binding function for the DOM.

Alert: this library is now deprecated. s2 is its successor. It implements what simulacra does in a better way (using Proxy), and more. Simulacra.js Si

郑达里 541 Nov 18, 2022
An easy peasy UI binding library.

Peasy UI This is the repository for Peasy UI, a small-ish and relatively easy to use UI binding library. Introduction Peasy UI provides uncomplicated

null 8 Nov 8, 2022
Necktie – a simple DOM binding tool

?? Necktie – a simple DOM binding tool Necktie is a library that binds your logic to the Document Object Model elements in an easy way. It has only ~3

Maciej Leśniewski 43 Oct 7, 2022
Node 18's node:test, as a node module

node-core-test This is a user-land port of node:test, the experimental test runner introduced in Node.js 18. This module makes it available in Node.js

Julian Gruber 62 Dec 15, 2022
Node-cli-starter - Basic starter kit for building Node CLI applications with TypeScript.

node-cli-starter Minimal starter kit for building Node CLI applications with TypeScript. Getting Started To get started clone repo locally and run npm

Cory Rylan 7 May 17, 2022