documentation
This commit is contained in:
@@ -27,25 +27,38 @@ The module builds on the lower-level bindings from
|
||||
|
||||
A context encapsulates a native webview context together with a local HTTPS
|
||||
server. Windows are created within a context and communicate through events and
|
||||
JavaScript calls.
|
||||
JavaScript calls. When an HTML file is
|
||||
served, the context's CSS boilerplate is injected immediately before the
|
||||
closing @tt{</head>} tag.
|
||||
|
||||
@section{Contexts}
|
||||
|
||||
|
||||
@defproc[(webview-new-context
|
||||
[file-getter procedure?]
|
||||
[#:boilerplate-js boilerplate-js string?
|
||||
(webview-default-boilerplate-js)])
|
||||
(webview-default-boilerplate-js)]
|
||||
[#:boilerplate-css boilerplate-css string?
|
||||
(webview-default-boilerplate-css)])
|
||||
wv-context?]{
|
||||
|
||||
Creates a new context.
|
||||
|
||||
The function:
|
||||
|
||||
@itemlist[#:style 'compact
|
||||
@item{starts a local HTTPS server on a dynamically chosen port}
|
||||
@item{generates a self-signed certificate}
|
||||
@item{creates a native context}
|
||||
@item{installs the provided JavaScript boilerplate}]
|
||||
@item{installs the provided JavaScript boilerplate in the native context}
|
||||
@item{stores the provided CSS boilerplate in the context}]
|
||||
|
||||
The @racket[file-getter] procedure maps request paths to files.
|
||||
The @racket[file-getter] procedure maps request paths to files. The
|
||||
@racket[#:boilerplate-js] argument provides JavaScript support code passed to
|
||||
the native context constructor. The javascript is injected by the native
|
||||
QtWebEngine software. The @racket[#:boilerplate-css] argument provides
|
||||
CSS boilerplate that is stored in the context and injected into served HTML
|
||||
documents.
|
||||
|
||||
Certificate files are removed automatically when the context is garbage
|
||||
collected.
|
||||
@@ -58,6 +71,7 @@ Returns the base URL of the context.
|
||||
This URL can be used to construct URLs from relative path information.
|
||||
}
|
||||
|
||||
|
||||
@defproc[(wv-context? [v any/c]) boolean?]{
|
||||
Recognizes context values.
|
||||
}
|
||||
@@ -147,6 +161,17 @@ Replaces the current document contents.
|
||||
X-expressions are converted to strings before being passed to JavaScript.
|
||||
}
|
||||
|
||||
@defproc[(webview-set-menu! [wv wv-win?] [menu is-wv-menu?])
|
||||
symbol?]{
|
||||
|
||||
Installs @racket[menu] in @racket[wv].
|
||||
|
||||
The menu is converted to JSON using @racket[wv-menu->json] and then passed to
|
||||
the browser by evaluating JavaScript through @racket[webview-run-js].
|
||||
|
||||
The result is the symbol returned by @racket[webview-run-js].
|
||||
}
|
||||
|
||||
@defproc[(webview-set-title! [wv wv-win?] [title string?]) symbol?]{
|
||||
Sets the window title.
|
||||
}
|
||||
@@ -525,9 +550,23 @@ Recognizes lists of filter entries.
|
||||
|
||||
@section{Utilities}
|
||||
|
||||
@defproc[(webview-default-boilerplate-js [f procedure?] ...)
|
||||
@defproc[(webview-default-boilerplate-js [custom-js procedure?] ...)
|
||||
string?]{
|
||||
|
||||
Returns the default JavaScript boilerplate.
|
||||
|
||||
The result is constructed by concatenating the contents of @tt{js/*.js}.
|
||||
If an additional procedure is supplied, its returned string is appended
|
||||
to that JavaScript.
|
||||
}
|
||||
|
||||
@defproc[(webview-default-boilerplate-css [custom-css procedure?] ...)
|
||||
string?]{
|
||||
|
||||
Returns the default CSS boilerplate.
|
||||
|
||||
The result is constructed by concatenating the contents of @tt{js/*.css}.
|
||||
If an additional procedure is supplied, its returned string is appended to that CSS.
|
||||
}
|
||||
|
||||
@defproc[(webview-standard-file-getter
|
||||
|
||||
Reference in New Issue
Block a user