dummy-link

Blink

Web-based GUIs for Julia

Readme

Blink.jl

Build Status

Blink.jl is the Julia wrapper around Electron. It can serve HTML content in a local window, and allows for communication between Julia and the web page. In this way, therefore, Blink can be used as a GUI toolkit for building HTML-based applications for the desktop.

To install, do:

julia> # press ] to enter the Pkg REPL mode
(v1.3) pkg> add Blink
# ... Blink builds and downloads Electron ...
(v1.3) pkg> # press backspace to exit Pkg REPL mode
julia> using Blink

Dependencies

  • 7z on Windows and unzip on Linux. You'll need to install the appropriate one for your system to be able to install Electron:
    • For Linux, apt get install -y unzip or similar should work.
    • For Windows, we use the 7z that is normally packaged with binary distributions of Julia (via the BinDeps.jl build dependency). 7z may be unavailable in case of a source build of Julia on Windows, in which case it can be obtained by running make win-extras after running make.

Basic usage:

julia> using Blink

julia> w = Window() # Open a new window
Blink.AtomShell.Window(...)

julia> body!(w, "Hello World") # Set the body content

julia> loadurl(w, "http://julialang.org") # Load a web page
Blink Window showing the JuliaLang website

For options see the functions defined in window.jl, which closely follow electron's API.

You can also use the JS API to interact with the window. For example:

julia> @js w Math.log(10)
2.302585092994046

If that's not convincing enough, open the console (Cmd-Alt-I on OS X) and evaluate:

@js w console.log("hello, web-scale world")

Issues & Caveats

  • On Windows, the spawned process dumps its output into Julia's STDOUT, which is kind of annoying.
  • When running on a headless linux instance (such as for CI tests), you must start julia via xvfb-run julia. More information can be found in the electron docs here. See the Blink.jl .travis.yml file for an example.

    Otherwise you will see the following error:

    │    LoadError: IOError: connect: connection refused (ECONNREFUSED)
    

First Commit

10/15/2014

Last Touched

4 days ago

Commits

447 commits