GithubHelp home page GithubHelp logo

linecode / deno_webview Goto Github PK

View Code? Open in Web Editor NEW

This project forked from webview/webview_deno

0.0 1.0 0.0 307 KB

Deno bindings for webview, a tiny library for creating web-based desktop GUIs

License: MIT License

Rust 54.85% TypeScript 45.15%

deno_webview's Introduction

deno_webview

license stars issues ci releases deno version deno doc

This project provides deno bindings for webview using the webview rust bindings. Webview is a tiny cross-platform library to render web-based GUIs for desktop applications. This project is still in an early stage of development and stability is sometimes questionable. The plugin should be compatible with MacOS (recently ran into some problems, but cannot solve the problem myself as i do not have acces to a mac), Linux and Windows. It has been tested on Windows and Xubuntu where it worked as expected using the latest versions of deno. The current goal of deno_webview is to provide high quality bindings to webview for creating light cross-platform applications using web technologies.

Example image

Example

Run the following code with the -A and --unstable (and -r if you have used this module before) flags enabled to get the example shown above:

import { WebView } from "../mod.ts";

const html = (n: number) =>
  `
  <html>
  <body>
    <h1>${n}</h1>
  </body>
  </html>
`;

const webview1 = new WebView({
  title: "Multiple deno_webview example",
  url: `data:text/html,${encodeURIComponent(html(1))}`,
  width: 400,
  height: 200,
  resizable: true,
  debug: true,
  frameless: false,
});

const webview2 = new WebView({
  title: "Multiple deno_webview example",
  url: `data:text/html,${encodeURIComponent(html(2))}`,
  width: 400,
  height: 200,
  resizable: true,
  debug: true,
  frameless: false,
});

await Promise.all([webview1.run(), webview2.run()]);

or just run the following in the terminal:

deno run -A -r --unstable https://deno.land/x/webview/examples/multiple.ts

Docs

Docs can be found here.

Mac specific: To use inline html you must first encodeURIComponent (#15).

Development

Prerequisites

For building deno_webview the same prerequisites as for building deno is required (mostly).

Linux

  • webkit2gtk (to install using apt: sudo apt-get install libwebkit2gtk-4.0-dev)

Cloning

To clone the repo simply run the following:

git clone https://github.com/eliassjogreen/deno_webview.git

and then cd into the repo:

cd deno_webview

Building

Building deno_webview takes about 20-50 minutes the first time (then like a minute) depending on your operating system. When building on Windows admin is required. Building is easiest done by running:

deno run -A scripts/build.ts

or

cargo build --release --locked

optionally with mshtml

deno run -A scripts/build.ts mshtml

or

cargo build --release --locked --no-default-features

Running

To run deno_webview without automatically downloading the binaries from releases you will need to use the enviornment variable DENO_WEBVIEW_PLUGIN and set it to the path where the binaries are located. This is usually file://./target/release. The process of running a using local binaries can be easier to do using the dev script:

deno -A scripts/dev.ts example.ts

Environment variables

  • DENO_WEBVIEW_PLUGIN - The URL of the plugin
    Due to MSHTML (ie) no longer being enabled by default, the only way to enable it is to set the DENO_WEBVIEW_PLUGIN variable to the path of a binary build built with the --no-default-features flag or using deno -A scripts/build.ts mshtml
  • DENO_WEBVIEW_PLUGIN_BASE - The URL of the plugin except the last part. Ignored if DENO_WEBVIEW_PLUGIN is set.
    When developing locally DENO_WEBVIEW_PLUGIN_BASE should be set to the directory containing the plugin binary, usually file://./target/release. Otherwise, don't set this.
  • DENO_WEBVIEW_DEBUG - Disable cache and enable logs for deno-plugin-prepare. Used for debugging.

Contributing

Contributions either in the form of pull requests or issues are always welcome. Just remember to format using deno -A scripts/fmt.ts (deno fmt and cargo fmt). Thx <3

Dependencies

Deno

Rust

deno_webview's People

Contributors

aralroca avatar buckle2000 avatar eliassjogreen avatar ganobrega avatar lemarier avatar sahithyandev avatar satyarohith avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.