1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
use glib::translate::*;

glib::wrapper! {
    #[derive(Debug, PartialEq, Eq, PartialOrd, Ord, Hash)]
    pub struct JavascriptResult(Shared<ffi::WebKitJavascriptResult>);

    match fn {
        ref => |ptr| ffi::webkit_javascript_result_ref(ptr),
        unref => |ptr| ffi::webkit_javascript_result_unref(ptr),
        type_ => || ffi::webkit_javascript_result_get_type(),
    }
}

impl JavascriptResult {
  #[cfg_attr(feature = "v2_22", deprecated = "Since 2.22")]
  #[doc(alias = "webkit_javascript_result_get_global_context")]
  #[doc(alias = "get_global_context")]
  pub fn global_context(&self) -> Option<javascriptcore::GlobalContextRef> {
    unsafe {
      from_glib_none(ffi::webkit_javascript_result_get_global_context(
        self.to_glib_none().0,
      ))
    }
  }

  #[cfg(any(feature = "v2_22", feature = "dox"))]
  #[cfg_attr(feature = "dox", doc(cfg(feature = "v2_22")))]
  #[doc(alias = "webkit_javascript_result_get_js_value")]
  #[doc(alias = "get_js_value")]
  pub fn js_value(&self) -> Option<javascriptcore::Value> {
    unsafe {
      from_glib_none(ffi::webkit_javascript_result_get_js_value(
        self.to_glib_none().0,
      ))
    }
  }

  #[cfg_attr(feature = "v2_22", deprecated = "Since 2.22")]
  #[doc(alias = "webkit_javascript_result_get_value")]
  #[doc(alias = "get_value")]
  pub fn value(&self) -> Option<javascriptcore::ValueRef> {
    unsafe {
      from_glib_none(ffi::webkit_javascript_result_get_value(
        self.to_glib_none().0,
      ))
    }
  }
}