chez-libs

Artifact [b054d2ebd2]
Login

Artifact b054d2ebd29d0c16f61d9e6d720ab6301303e7fa:

Wiki page [(system webview)] by murphy 2018-08-26 22:24:23.
D 2018-08-26T22:24:23.549
L (system\swebview)
P c1a81de04ac7916c862465e562d5072dcf7d6f58
U murphy
W 2778
<h1>Webview Bindings</h1>

<code>(import (system webview))</code>

Bindings to a modified version of the [https://github.com/zserge/webview|webview] library.

<h2>Main Interface</h2>

<h3>procedure: <code>(webview <i>title</i> <i>url</i> <i>on-external-invoke</i> <i>option</i> ...)</code></h3>

Launch a webview with the given title, URL, external invocation callback and possibly additional configuration options.

The external invocation callback receives two arguments: The webview and a string. The string argument is provided by JavaScript on the page using a call to <tt>window.external.invoke</tt>.

Both the URL and callback procedure may be <tt>#f</tt>. If no URL is passed, an empty default page is used that calls <tt>window.external.invoke("load")</tt> once when loaded. If no callback procedure is passed,
 <tt>window.external.invoke</tt> is available but does nothing.

The list of additional configuration options may contain the following keys:

  *  <tt>width</tt> to specify window width
  *  <tt>height</tt> to specify window height
  *  <tt>resizable?</tt> to specify whether the window size may be changed
  *  <tt>debug?</tt> to specify whether debugging tools should be enabled

<h3>procedure: <code>(webview-terminate! <i>webview</i>)</code></h3>

Ask the given webview to quit.

<h3>procedure: <code>(webview-title-set! <i>webview</i> <i>title</i>)</code></h3>

Change the title of the given webview.

<h3>procedure: <code>(webview-fullscreen-set! <i>webview</i> <i>fullscreen?</i>)</code></h3>

Change the fullscreen state of the given webview.

<h3>procedure: <code>(webview-eval <i>webview</i> <i>code</i>)</code></h3>

Evaluate JavaScript code in the given webview.

<h2>Dialog Interface</h2>

<h3>syntax: <code>(dialog-type-flag <i>symbol</i>)</code></h3>
<h3>syntax: <code>(dialog-type <i>symbol</i> ...)</code></h3>

The dialog flags enumeration is used to indicate the type of dialog presented by <tt>webview-dialog</tt>:

  *  <tt>open</tt> shows a file open dialog
  *  <tt>save</tt> shows a file save dialog
  *  <tt>directory</tt> allows selection of a directory instead of a file
  *  <tt>info</tt> shows an informational message
  *  <tt>warning</tt> shows a warning message
  *  <tt>error</tt> shows an error message

<h3>procedure: <code>(webview-dialog <i>webview</i> <i>type</i> <i>title</i> <i>value</i>)</code></h3>
<h3>procedure: <code>(webview-dialog <i>webview</i> <i>type</i> <i>title</i>)</code></h3>

Present a dialog as a modal child of the given webview. Returns the data selected in the dialog or <tt>#f</tt>.

<h2>Miscellaneous</h2>

<h3>procedure: <code>(logf <i>fmt</i> <i>arg</i> ...)</code></h3>

Log a formatted message to some system-specific channel.

Z 93fa6354587e4c57c24f1d80e577db28