API
#ui/webview
Xu 0.8.8 API
import: #ui/webview
counts: 38 函数, 10 方法, 1 类型, 0 常量, 0 方法集
把 webview 挂到 ui.Window:load_html/url、eval、on/emit。
struct WebView
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
pub fn attach(w &mut ui.Window) WebView
用途
attach,返回 WebView。
参数
w &mut ui.Window- 写入侧 / 宽度(独占借用;类型 &mut ui.Window)
返回
WebView — 该类型的值
www_root_path
pub fn www_root_path() string
用途
wwwrootpath。
参数
无
返回
string — 结果字符串
resolve_www_dir
pub fn resolve_www_dir(want string) string
用途
解析www目录部分。失败时 throw。
参数
want string- want(string)
返回
string — 结果字符串
stage_www_root
pub fn stage_www_root(dir0 string) int
用途
stagewwwroot。失败时 throw。
参数
dir0 string- dir0(string)
返回
int — 该类型的值
ipc_encode_xun
pub fn ipc_encode_xun(name string, payload string) string
用途
ipc编码xun。
参数
name string- 名字(string)
payload string- payload(string)
返回
string — 结果字符串
ipc_encode_result
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
pub fn ipc_decode_name(raw string) string
用途
ipc解码名称。
参数
raw string- raw(string)
返回
string — 结果字符串
ipc_decode_payload
pub fn ipc_decode_payload(raw string) string
用途
ipc解码payload。
参数
raw string- raw(string)
返回
string — 结果字符串
ipc_decode_result
pub fn ipc_decode_result(raw string) string
用途
ipc解码结果。
参数
raw string- raw(string)
返回
string — 结果字符串
bridge_script
pub fn bridge_script() string
用途
bridgescript。
参数
无
返回
string — 结果字符串
app_scheme_url
pub fn app_scheme_url() string
用途
appschemeurl。
参数
无
返回
string — 结果字符串
default_ipc_addr
pub fn default_ipc_addr() string
用途
defaultipc地址。
参数
无
返回
string — 结果字符串
default_ipc_port
pub fn default_ipc_port() string
用途
defaultipc端口。
参数
无
返回
string — 结果字符串
(&mut WebView) load_html
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
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
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
pub fn (wv &mut WebView) load_file(path string) int
用途
`&mut WebView` 上的方法:读文件。失败时 throw。
参数
wv &mut WebView- 接收者 &mut WebView(可变借用)
path string- 文件系统路径(string)
返回
int — 该类型的值
native_eval
pub fn native_eval(js string) int
用途
nativeeval。失败时 throw。
参数
js string- js(string)
返回
int — 该类型的值
native_reload
pub fn native_reload() int
用途
nativereload。失败时 throw。
参数
无
返回
int — 该类型的值
native_open_devtools
pub fn native_open_devtools() int
用途
native打开devtools。失败时 throw。
参数
无
返回
int — 该类型的值
native_set_zoom
pub fn native_set_zoom(zoom_percent int) int
用途
nativesetzoom。失败时 throw。
参数
zoom_percent int- zoom_percent(int)
返回
int — 该类型的值
native_go_back
pub fn native_go_back() int
用途
nativego队尾。失败时 throw。
参数
无
返回
int — 该类型的值
native_go_forward
pub fn native_go_forward() int
用途
nativegoforward。失败时 throw。
参数
无
返回
int — 该类型的值
native_stop
用途
native停止。失败时 throw。
参数
无
返回
int — 该类型的值
native_print
pub fn native_print() int
用途
native打印。失败时 throw。
参数
无
返回
int — 该类型的值
native_eval_result
pub fn native_eval_result(js string) string
用途
nativeeval结果。
参数
js string- js(string)
返回
string — 结果字符串
native_find
pub fn native_find(text string) int
用途
nativefind。
参数
text string- 文本(string)
返回
int — 该类型的值
native_find_clear
pub fn native_find_clear() int
用途
nativefindclear。
参数
无
返回
int — 该类型的值
native_set_user_agent
pub fn native_set_user_agent(ua string) int
用途
nativeset用户agent。
参数
ua string- ua(string)
返回
int — 该类型的值
native_inject_css
pub fn native_inject_css(css string) int
用途
nativeinjectcss。
参数
css string- css(string)
返回
int — 该类型的值
native_clear_cache
pub fn native_clear_cache() int
用途
nativeclearcache。
参数
无
返回
int — 该类型的值
native_set_muted
pub fn native_set_muted(on int) int
用途
nativesetmuted。
参数
on int- on(int)
返回
int — 该类型的值
native_set_background
pub fn native_set_background(hex string) int
用途
nativeset根上下文。
参数
hex string- hex(string)
返回
int — 该类型的值
native_set_magnification
pub fn native_set_magnification(on int) int
用途
nativesetmagnification。
参数
on int- on(int)
返回
int — 该类型的值
native_cookies_get
pub fn native_cookies_get() string
用途
nativecookiesget。
参数
无
返回
string — 结果字符串
native_cookies_clear
pub fn native_cookies_clear() int
用途
nativecookiesclear。
参数
无
返回
int — 该类型的值
native_cookie_set
pub fn native_cookie_set(name string, value string, domain string) int
用途
nativeCookieset。
参数
name string- 名字(string)
value string- value(string)
domain string- domain(string)
返回
int — 该类型的值
(&mut WebView) eval
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
pub fn (wv &mut WebView) on(name string)
用途
`&mut WebView` 上的方法:于。
参数
wv &mut WebView- 接收者 &mut WebView(可变借用)
name string- 名字(string)
(&mut WebView) invoke
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
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
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
pub fn (wv &mut WebView) emit_pending_count() int
用途
`&mut WebView` 上的方法:emitpending计数。
参数
wv &mut WebView- 接收者 &mut WebView(可变借用)
返回
int — 该类型的值
(&mut WebView) clear_emits
pub fn (wv &mut WebView) clear_emits()
用途
`&mut WebView` 上的方法:clearemits。
参数
wv &mut WebView- 接收者 &mut WebView(可变借用)
bind_ipc_www
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
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
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 — 该类型的值