XU XUv0.8.8
EN

API

#ui/webview

import: #ui/webview

counts: 38 函数, 10 方法, 1 类型, 0 常量, 0 方法集

把 webview 挂到 ui.Window:load_html/url、eval、on/emit。

struct WebView

XuAPI
pub struct WebView {
    pub id int
    pub window_id int
    pub html string
    pub url string
    pub ipc_names []string
    pub emit_q []string
    pub sim int
}

用途

公开结构体 `WebView`。

参数

id int
字段(int)
window_id int
字段(int)
html string
字段(string)
url string
字段(string)
ipc_names []string
字段([]string)
emit_q []string
字段([]string)
sim int
字段(int)

attach

XuAPI
pub fn attach(w &mut ui.Window) WebView

用途

attach,返回 WebView。

参数

w &mut ui.Window
写入侧 / 宽度(独占借用;类型 &mut ui.Window)

返回

WebView — 该类型的值

www_root_path

XuAPI
pub fn www_root_path() string

用途

wwwrootpath。

参数

无

返回

string — 结果字符串

resolve_www_dir

XuAPI
pub fn resolve_www_dir(want string) string

用途

解析www目录部分。失败时 throw。

参数

want string
want(string)

返回

string — 结果字符串

stage_www_root

XuAPI
pub fn stage_www_root(dir0 string) int

用途

stagewwwroot。失败时 throw。

参数

dir0 string
dir0(string)

返回

int — 该类型的值

ipc_encode_xun

XuAPI
pub fn ipc_encode_xun(name string, payload string) string

用途

ipc编码xun。

参数

name string
名字(string)
payload string
payload(string)

返回

string — 结果字符串

ipc_encode_result

XuAPI
pub fn ipc_encode_result(ok bool, result string, err string) string

用途

ipc编码结果。

参数

ok bool
ok(bool)
result string
result(string)
err string
错误(string)

返回

string — 结果字符串

ipc_decode_name

XuAPI
pub fn ipc_decode_name(raw string) string

用途

ipc解码名称。

参数

raw string
raw(string)

返回

string — 结果字符串

ipc_decode_payload

XuAPI
pub fn ipc_decode_payload(raw string) string

用途

ipc解码payload。

参数

raw string
raw(string)

返回

string — 结果字符串

ipc_decode_result

XuAPI
pub fn ipc_decode_result(raw string) string

用途

ipc解码结果。

参数

raw string
raw(string)

返回

string — 结果字符串

bridge_script

XuAPI
pub fn bridge_script() string

用途

bridgescript。

参数

无

返回

string — 结果字符串

app_scheme_url

XuAPI
pub fn app_scheme_url() string

用途

appschemeurl。

参数

无

返回

string — 结果字符串

default_ipc_addr

XuAPI
pub fn default_ipc_addr() string

用途

defaultipc地址。

参数

无

返回

string — 结果字符串

default_ipc_port

XuAPI
pub fn default_ipc_port() string

用途

defaultipc端口。

参数

无

返回

string — 结果字符串

(&mut WebView) load_html

XuAPI
pub fn (wv &mut WebView) load_html(html string) int

用途

`&mut WebView` 上的方法:读HTML。失败时 throw。

参数

wv &mut WebView
接收者 &mut WebView(可变借用)
html string
html(string)

返回

int — 该类型的值

(&mut WebView) load_url

XuAPI
pub fn (wv &mut WebView) load_url(url string) int

用途

`&mut WebView` 上的方法:读url。失败时 throw。

参数

wv &mut WebView
接收者 &mut WebView(可变借用)
url string
url(string)

返回

int — 该类型的值

(&mut WebView) load_remote

XuAPI
pub fn (wv &mut WebView) load_remote(url string) int

用途

`&mut WebView` 上的方法:读remote。失败时 throw。

参数

wv &mut WebView
接收者 &mut WebView(可变借用)
url string
url(string)

返回

int — 该类型的值

(&mut WebView) load_file

XuAPI
pub fn (wv &mut WebView) load_file(path string) int

用途

`&mut WebView` 上的方法:读文件。失败时 throw。

参数

wv &mut WebView
接收者 &mut WebView(可变借用)
path string
文件系统路径(string)

返回

int — 该类型的值

native_eval

XuAPI
pub fn native_eval(js string) int

用途

nativeeval。失败时 throw。

参数

js string
js(string)

返回

int — 该类型的值

native_reload

XuAPI
pub fn native_reload() int

用途

nativereload。失败时 throw。

参数

无

返回

int — 该类型的值

native_open_devtools

XuAPI
pub fn native_open_devtools() int

用途

native打开devtools。失败时 throw。

参数

无

返回

int — 该类型的值

native_set_zoom

XuAPI
pub fn native_set_zoom(zoom_percent int) int

用途

nativesetzoom。失败时 throw。

参数

zoom_percent int
zoom_percent(int)

返回

int — 该类型的值

native_go_back

XuAPI
pub fn native_go_back() int

用途

nativego队尾。失败时 throw。

参数

无

返回

int — 该类型的值

native_go_forward

XuAPI
pub fn native_go_forward() int

用途

nativegoforward。失败时 throw。

参数

无

返回

int — 该类型的值

native_stop

XuAPI
pub fn native_stop() int

用途

native停止。失败时 throw。

参数

无

返回

int — 该类型的值

native_print

XuAPI
pub fn native_print() int

用途

native打印。失败时 throw。

参数

无

返回

int — 该类型的值

native_eval_result

XuAPI
pub fn native_eval_result(js string) string

用途

nativeeval结果。

参数

js string
js(string)

返回

string — 结果字符串

native_find

XuAPI
pub fn native_find(text string) int

用途

nativefind。

参数

text string
文本(string)

返回

int — 该类型的值

native_find_clear

XuAPI
pub fn native_find_clear() int

用途

nativefindclear。

参数

无

返回

int — 该类型的值

native_set_user_agent

XuAPI
pub fn native_set_user_agent(ua string) int

用途

nativeset用户agent。

参数

ua string
ua(string)

返回

int — 该类型的值

native_inject_css

XuAPI
pub fn native_inject_css(css string) int

用途

nativeinjectcss。

参数

css string
css(string)

返回

int — 该类型的值

native_clear_cache

XuAPI
pub fn native_clear_cache() int

用途

nativeclearcache。

参数

无

返回

int — 该类型的值

native_set_muted

XuAPI
pub fn native_set_muted(on int) int

用途

nativesetmuted。

参数

on int
on(int)

返回

int — 该类型的值

native_set_background

XuAPI
pub fn native_set_background(hex string) int

用途

nativeset根上下文。

参数

hex string
hex(string)

返回

int — 该类型的值

native_set_context_menu

XuAPI
pub fn native_set_context_menu(on int) int

用途

nativeset上下文menu。

参数

on int
on(int)

返回

int — 该类型的值

native_set_magnification

XuAPI
pub fn native_set_magnification(on int) int

用途

nativesetmagnification。

参数

on int
on(int)

返回

int — 该类型的值

native_cookies_get

XuAPI
pub fn native_cookies_get() string

用途

nativecookiesget。

参数

无

返回

string — 结果字符串

native_cookies_clear

XuAPI
pub fn native_cookies_clear() int

用途

nativecookiesclear。

参数

无

返回

int — 该类型的值

(&mut WebView) eval

XuAPI
pub fn (wv &mut WebView) eval(js string) string

用途

在 `&mut WebView` 上调用 `eval`。失败时 throw。

参数

wv &mut WebView
接收者 &mut WebView(可变借用)
js string
js(string)

返回

string — 结果字符串

(&mut WebView) on

XuAPI
pub fn (wv &mut WebView) on(name string)

用途

`&mut WebView` 上的方法:于。

参数

wv &mut WebView
接收者 &mut WebView(可变借用)
name string
名字(string)

(&mut WebView) invoke

XuAPI
pub fn (wv &mut WebView) invoke(name string, payload string, dispatch fn(string, string) string) string

用途

在 `&mut WebView` 上调用 `invoke`。

参数

wv &mut WebView
接收者 &mut WebView(可变借用)
name string
名字(string)
payload string
payload(string)
dispatch fn(string, string) string
dispatch(函数值;类型 fn(string, string) string)

返回

string — 结果字符串

bus_emit

XuAPI
pub fn bus_emit(emit_ch chan string, name string, payload string)

用途

busemit。

参数

emit_ch chan string
emit_ch(通道;类型 chan string)
name string
名字(string)
payload string
payload(string)

(&mut WebView) emit

XuAPI
pub fn (wv &mut WebView) emit(name string, payload string) int

用途

在 `&mut WebView` 上调用 `emit`。

参数

wv &mut WebView
接收者 &mut WebView(可变借用)
name string
名字(string)
payload string
payload(string)

返回

int — 该类型的值

(&mut WebView) emit_pending_count

XuAPI
pub fn (wv &mut WebView) emit_pending_count() int

用途

`&mut WebView` 上的方法:emitpending计数。

参数

wv &mut WebView
接收者 &mut WebView(可变借用)

返回

int — 该类型的值

(&mut WebView) clear_emits

XuAPI
pub fn (wv &mut WebView) clear_emits()

用途

`&mut WebView` 上的方法:clearemits。

参数

wv &mut WebView
接收者 &mut WebView(可变借用)

bind_ipc_www

XuAPI
pub fn bind_ipc_www(www_dir string, dispatch fn(string, string) string, emit_ch chan string, shell_ch chan ui.Event) int

用途

bindipcwww。失败时 throw。

参数

www_dir string
www_dir(string)
dispatch fn(string, string) string
dispatch(函数值;类型 fn(string, string) string)
emit_ch chan string
emit_ch(通道;类型 chan string)
shell_ch chan ui.Event
shell_ch(通道;类型 chan ui.Event)

返回

int — 该类型的值

bind_ipc

XuAPI
pub fn bind_ipc(page string, dispatch fn(string, string) string, emit_ch chan string, shell_ch chan ui.Event) int

用途

bindipc。失败时 throw。

参数

page string
page(string)
dispatch fn(string, string) string
dispatch(函数值;类型 fn(string, string) string)
emit_ch chan string
emit_ch(通道;类型 chan string)
shell_ch chan ui.Event
shell_ch(通道;类型 chan ui.Event)

返回

int — 该类型的值

serve_ipc

XuAPI
pub fn serve_ipc(addr string, page string, dispatch fn(string, string) string, emit_ch chan string, shell_ch chan ui.Event) int

用途

serveipc。失败时 throw。

参数

addr string
地址(string)
page string
page(string)
dispatch fn(string, string) string
dispatch(函数值;类型 fn(string, string) string)
emit_ch chan string
emit_ch(通道;类型 chan string)
shell_ch chan ui.Event
shell_ch(通道;类型 chan ui.Event)

返回

int — 该类型的值