objc2_web_kit/generated/
WKScriptMessage.rs

1//! This file has been automatically generated by `objc2`'s `header-translator`.
2//! DO NOT EDIT
3use core::ptr::NonNull;
4use objc2::__framework_prelude::*;
5use objc2_foundation::*;
6
7use crate::*;
8
9extern_class!(
10    /// A WKScriptMessage object contains information about a message sent from
11    /// a webpage.
12    ///
13    /// See also [Apple's documentation](https://developer.apple.com/documentation/webkit/wkscriptmessage?language=objc)
14    #[unsafe(super(NSObject))]
15    #[thread_kind = MainThreadOnly]
16    #[derive(Debug, PartialEq, Eq, Hash)]
17    pub struct WKScriptMessage;
18);
19
20extern_conformance!(
21    unsafe impl NSObjectProtocol for WKScriptMessage {}
22);
23
24impl WKScriptMessage {
25    extern_methods!(
26        /// The body of the message.
27        ///
28        /// Allowed types are NSNumber, NSString, NSDate, NSArray,
29        /// NSDictionary, and NSNull.
30        #[unsafe(method(body))]
31        #[unsafe(method_family = none)]
32        pub unsafe fn body(&self) -> Retained<AnyObject>;
33
34        #[cfg(all(feature = "WKWebView", feature = "objc2-app-kit"))]
35        #[cfg(target_os = "macos")]
36        /// The web view sending the message.
37        #[unsafe(method(webView))]
38        #[unsafe(method_family = none)]
39        pub unsafe fn webView(&self) -> Option<Retained<WKWebView>>;
40
41        #[cfg(feature = "WKFrameInfo")]
42        /// The frame sending the message.
43        #[unsafe(method(frameInfo))]
44        #[unsafe(method_family = none)]
45        pub unsafe fn frameInfo(&self) -> Retained<WKFrameInfo>;
46
47        /// The name of the message handler to which the message is sent.
48        #[unsafe(method(name))]
49        #[unsafe(method_family = none)]
50        pub unsafe fn name(&self) -> Retained<NSString>;
51
52        #[cfg(feature = "WKContentWorld")]
53        /// The content world from which the message was sent.
54        #[unsafe(method(world))]
55        #[unsafe(method_family = none)]
56        pub unsafe fn world(&self) -> Retained<WKContentWorld>;
57    );
58}
59
60/// Methods declared on superclass `NSObject`.
61impl WKScriptMessage {
62    extern_methods!(
63        #[unsafe(method(init))]
64        #[unsafe(method_family = init)]
65        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
66
67        #[unsafe(method(new))]
68        #[unsafe(method_family = new)]
69        pub unsafe fn new(mtm: MainThreadMarker) -> Retained<Self>;
70    );
71}