Artifact
c1a81de04ac7916c862465e562d5072dcf7d6f58:
Wiki page
[(system webview)] by
murphy
2018-02-03 00:16:13.
D 2018-02-03T00:16:13.924
L (system\swebview)
P 266678234318a3adeb129c572c6deb3967b7e7ba
U murphy
W 2952
<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-color-set! <i>webview</i> <i>red</i> <i>green</i> <i>blue</i> <i>alpha</i>)</code></h3>
Change the background color 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 e2b2ab133b4a9929da623eaa3229e222