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
20unsafe impl NSObjectProtocol for WKScriptMessage {}
21
22impl WKScriptMessage {
23    extern_methods!(
24        /// The body of the message.
25        ///
26        /// Allowed types are NSNumber, NSString, NSDate, NSArray,
27        /// NSDictionary, and NSNull.
28        #[unsafe(method(body))]
29        #[unsafe(method_family = none)]
30        pub unsafe fn body(&self) -> Retained<AnyObject>;
31
32        #[cfg(all(feature = "WKWebView", feature = "objc2-app-kit"))]
33        #[cfg(target_os = "macos")]
34        /// The web view sending the message.
35        #[unsafe(method(webView))]
36        #[unsafe(method_family = none)]
37        pub unsafe fn webView(&self) -> Option<Retained<WKWebView>>;
38
39        #[cfg(feature = "WKFrameInfo")]
40        /// The frame sending the message.
41        #[unsafe(method(frameInfo))]
42        #[unsafe(method_family = none)]
43        pub unsafe fn frameInfo(&self) -> Retained<WKFrameInfo>;
44
45        /// The name of the message handler to which the message is sent.
46        #[unsafe(method(name))]
47        #[unsafe(method_family = none)]
48        pub unsafe fn name(&self) -> Retained<NSString>;
49
50        #[cfg(feature = "WKContentWorld")]
51        /// The content world from which the message was sent.
52        #[unsafe(method(world))]
53        #[unsafe(method_family = none)]
54        pub unsafe fn world(&self) -> Retained<WKContentWorld>;
55    );
56}
57
58/// Methods declared on superclass `NSObject`.
59impl WKScriptMessage {
60    extern_methods!(
61        #[unsafe(method(init))]
62        #[unsafe(method_family = init)]
63        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
64
65        #[unsafe(method(new))]
66        #[unsafe(method_family = new)]
67        pub unsafe fn new(mtm: MainThreadMarker) -> Retained<Self>;
68    );
69}