WebView

The main struct

Constructors

this
this(bool enableDebug, void* window)

Create a new WebView.

Members

Classes

Element
class Element
Undocumented in source.
Elements
class Elements
Undocumented in source.

Functions

bindJs
void bindJs(string jsFunc, void* extra)
void bindJs(void* extra)

Create a callback in D for a js function.

byId
Element byId(string id)

Search for an element in the dom, using id. Returned element can forward calls to js.

bySelector
Element bySelector(string query)

Search for an element in the dom, using a css selector. Returned element can forward calls to js.

create
void create(bool enableDebug, void* window)

Create a new WebView.

eval
void eval(string js, void* extra)

Eval some js code. When it is done, func() is called (optional)

html
void html(string data)

Set webview HTML directly.

navigate
void navigate(string url)

Navigates webview to the given URL. URL may be a properly encoded data URI.

onInit
void onInit(string js)
void onInit()

Injects JavaScript code at the initialization of the new page. Every time the webview will open a new page - this initialization code will be executed. It is guaranteed that code is executed before window.onload.

reject
void reject(string seq, JSONValue v)

Reject a js promise

resolve
void resolve(string seq, JSONValue v)

Resolve a js promise

respond
void respond(string seq, bool resolved, JSONValue v)

Respond to a binding call from js.

run
void run()

Start the WebView. Be sure to set size before.

size
void size(int width, int height, int hints)

Set the window size

terminate
void terminate()
title
void title(string title)

Set the window title

unbindJs
void unbindJs(string name)

Removes a D callback that was previously set by bind()

window
void* window()

Returns a handle to the native window

Static functions

fileAsDataUri
string fileAsDataUri(string file, string mimeType)

Helper function to convert bytes to data uri to embed inside html

importAsDataUri
string importAsDataUri(string mimeType)

Helper function to convert a file to data uri to embed inside html. It works at compile-time so you must set source import paths on your project.

parseJsArgs
auto parseJsArgs(JSONValue[] v)

A helper function to parse args passed as JSONValue[]

toDataUri
auto toDataUri(ubyte[] bytes, string mimeType)

Helper function to convert bytes to data uri to embed inside html

Meta