wilton.js  v202103141
 All Namespaces Functions
Functions
kiosk Namespace Reference

wilton/kiosk
Open WebView window as a Kiosk. More...

Functions

Undefined run (Object options, Function|Undefined callback)
 Open and run a WebView window in a current thread.

Detailed Description

This module allows to open and run the WebView window in the current thread.

Caller thread remains blocked until the WebView window is closed.

Uses WebKitGTK backend on Linux and OpenJFX on Windows (requires rhino or nashorn engine).

Usage example:

// open URL in a non-fullscreen window
kiosk.run({
url: "http://localhost:8080",
fullscreen: false,
windowWidth: 800,
windowHeight: 600
});

Example of calling JS script in Wilton context (with full access to Wilton API), enableWiltonCalls option must be set:

var callDesc = JSON.stringify({
module: "my/mod1",
func: "mufun1",
args: ["foo", 42]
});
// on Linux, no result available
window.webkit.messageHandlers.wilton.postMessage(callDesc);
// on Windows
var res = window.wilton.callWiltonModule(callDesc);

Function Documentation

Undefined kiosk::run ( Object  options,
Function|Undefined  callback 
)

Opens a WebView window with a specified URL to load.

Current thread remains blocked until WebView window is closed.

Note: on Linux it is better to run kiosk on duktape JS engine, on Windows rhino or nashorn JS engine must be used because on Windows kiosk relies on OpenJFX.

Parameters
optionsObject configuration object, see possible options below
callbackFunction|Undefined callback to receive result or error
Returns
Undefined

Options

  • url String web address to load in this WebView
  • fullscreen Boolean|Undefined whether to make a window full-screen, default value: true
  • fullscreenKey Number|Undefined keyboard key to switch WebView window between full-screen and non-full-screen modes, for GTK+ backend see keys mapping: https://gitlab.gnome.org/GNOME/gtk/raw/master/gdk/gdkkeysyms.h , default value on Linux: F11; non-configurable on Windows, default value: Esc
  • closeKey Number|Undefined keyboard key to close the WebView window for GTK+ backend see keys mapping: https://gitlab.gnome.org/GNOME/gtk/raw/master/gdk/gdkkeysyms.h , default value: Escape; not supported on Windows
  • windowWidth Number|Undefined window width in pixels, default value: 640
  • windowHeight Number|Undefined window height in pixels, default value: 480
  • consoleToStdout Boolean|Undefined redirect console.log() messages to STDOUT, default value: false; not supported on Windows
  • inspectorMode Boolean|Undefined enable WebView code inspector, default value: false; not supported on Windows
  • enableWiltonCalls Boolean|Undefined allow to call native code through wiltoncall API, default value: false
  • windowTitle String|Undefined title of the WebView window, default value: wilton
  • windowIconPath String|Undefined path to the PNG file to use as a WebView window icon, default value: wilton icon; not supported on Linux
  • fxStageCallback String|Undefined path to the PNG file to use as a WebView window icon, default value: function(stage) { stage.show(); }