Skip to main content

web_sys/features/
gen_Geolocation.rs

1#![allow(unused_imports)]
2#![allow(clippy::all)]
3use super::*;
4use wasm_bindgen::prelude::*;
5#[wasm_bindgen]
6extern "C" {
7    # [wasm_bindgen (is_type_of = | _ | false , extends = "::js_sys::Object" , js_name = "Geolocation" , typescript_type = "Geolocation")]
8    #[derive(Debug, Clone, PartialEq, Eq)]
9    #[doc = "The `Geolocation` class."]
10    #[doc = ""]
11    #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/Geolocation)"]
12    #[doc = ""]
13    #[doc = "*This API requires the following crate features to be activated: `Geolocation`*"]
14    pub type Geolocation;
15    #[wasm_bindgen(method, js_class = "Geolocation", js_name = "clearWatch")]
16    #[doc = "The `clearWatch()` method."]
17    #[doc = ""]
18    #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/Geolocation/clearWatch)"]
19    #[doc = ""]
20    #[doc = "*This API requires the following crate features to be activated: `Geolocation`*"]
21    pub fn clear_watch(this: &Geolocation, watch_id: i32);
22    #[cfg(not(web_sys_unstable_apis))]
23    #[wasm_bindgen(
24        catch,
25        method,
26        js_class = "Geolocation",
27        js_name = "getCurrentPosition"
28    )]
29    #[doc = "The `getCurrentPosition()` method."]
30    #[doc = ""]
31    #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/Geolocation/getCurrentPosition)"]
32    #[doc = ""]
33    #[doc = "*This API requires the following crate features to be activated: `Geolocation`*"]
34    pub fn get_current_position(
35        this: &Geolocation,
36        success_callback: &::js_sys::Function,
37    ) -> Result<(), JsValue>;
38    #[cfg(not(web_sys_unstable_apis))]
39    #[wasm_bindgen(
40        catch,
41        method,
42        js_class = "Geolocation",
43        js_name = "getCurrentPosition"
44    )]
45    #[doc = "The `getCurrentPosition()` method."]
46    #[doc = ""]
47    #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/Geolocation/getCurrentPosition)"]
48    #[doc = ""]
49    #[doc = "*This API requires the following crate features to be activated: `Geolocation`*"]
50    pub fn get_current_position_with_error_callback(
51        this: &Geolocation,
52        success_callback: &::js_sys::Function,
53        error_callback: Option<&::js_sys::Function>,
54    ) -> Result<(), JsValue>;
55    #[cfg(not(web_sys_unstable_apis))]
56    #[cfg(feature = "PositionOptions")]
57    #[wasm_bindgen(
58        catch,
59        method,
60        js_class = "Geolocation",
61        js_name = "getCurrentPosition"
62    )]
63    #[doc = "The `getCurrentPosition()` method."]
64    #[doc = ""]
65    #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/Geolocation/getCurrentPosition)"]
66    #[doc = ""]
67    #[doc = "*This API requires the following crate features to be activated: `Geolocation`, `PositionOptions`*"]
68    pub fn get_current_position_with_error_callback_and_options(
69        this: &Geolocation,
70        success_callback: &::js_sys::Function,
71        error_callback: Option<&::js_sys::Function>,
72        options: &PositionOptions,
73    ) -> Result<(), JsValue>;
74    #[cfg(web_sys_unstable_apis)]
75    #[cfg(feature = "GeolocationPosition")]
76    #[wasm_bindgen(method, js_class = "Geolocation", js_name = "getCurrentPosition")]
77    #[doc = "The `getCurrentPosition()` method."]
78    #[doc = ""]
79    #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/Geolocation/getCurrentPosition)"]
80    #[doc = ""]
81    #[doc = "*This API requires the following crate features to be activated: `Geolocation`, `GeolocationPosition`*"]
82    #[doc = ""]
83    #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"]
84    #[doc = "[described in the `wasm-bindgen` guide](https://wasm-bindgen.github.io/wasm-bindgen/web-sys/unstable-apis.html)*"]
85    pub fn get_current_position(
86        this: &Geolocation,
87        success_callback: &::js_sys::Function<fn(GeolocationPosition) -> ::js_sys::Undefined>,
88    );
89    #[cfg(web_sys_unstable_apis)]
90    #[cfg(all(feature = "GeolocationPosition", feature = "GeolocationPositionError",))]
91    #[wasm_bindgen(method, js_class = "Geolocation", js_name = "getCurrentPosition")]
92    #[doc = "The `getCurrentPosition()` method."]
93    #[doc = ""]
94    #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/Geolocation/getCurrentPosition)"]
95    #[doc = ""]
96    #[doc = "*This API requires the following crate features to be activated: `Geolocation`, `GeolocationPosition`, `GeolocationPositionError`*"]
97    #[doc = ""]
98    #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"]
99    #[doc = "[described in the `wasm-bindgen` guide](https://wasm-bindgen.github.io/wasm-bindgen/web-sys/unstable-apis.html)*"]
100    pub fn get_current_position_with_error_callback(
101        this: &Geolocation,
102        success_callback: &::js_sys::Function<fn(GeolocationPosition) -> ::js_sys::Undefined>,
103        error_callback: Option<
104            &::js_sys::Function<fn(GeolocationPositionError) -> ::js_sys::Undefined>,
105        >,
106    );
107    #[cfg(web_sys_unstable_apis)]
108    #[cfg(all(
109        feature = "GeolocationPosition",
110        feature = "GeolocationPositionError",
111        feature = "PositionOptions",
112    ))]
113    #[wasm_bindgen(method, js_class = "Geolocation", js_name = "getCurrentPosition")]
114    #[doc = "The `getCurrentPosition()` method."]
115    #[doc = ""]
116    #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/Geolocation/getCurrentPosition)"]
117    #[doc = ""]
118    #[doc = "*This API requires the following crate features to be activated: `Geolocation`, `GeolocationPosition`, `GeolocationPositionError`, `PositionOptions`*"]
119    #[doc = ""]
120    #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"]
121    #[doc = "[described in the `wasm-bindgen` guide](https://wasm-bindgen.github.io/wasm-bindgen/web-sys/unstable-apis.html)*"]
122    pub fn get_current_position_with_error_callback_and_options(
123        this: &Geolocation,
124        success_callback: &::js_sys::Function<fn(GeolocationPosition) -> ::js_sys::Undefined>,
125        error_callback: Option<
126            &::js_sys::Function<fn(GeolocationPositionError) -> ::js_sys::Undefined>,
127        >,
128        options: &PositionOptions,
129    );
130    #[cfg(not(web_sys_unstable_apis))]
131    #[wasm_bindgen(catch, method, js_class = "Geolocation", js_name = "watchPosition")]
132    #[doc = "The `watchPosition()` method."]
133    #[doc = ""]
134    #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/Geolocation/watchPosition)"]
135    #[doc = ""]
136    #[doc = "*This API requires the following crate features to be activated: `Geolocation`*"]
137    pub fn watch_position(
138        this: &Geolocation,
139        success_callback: &::js_sys::Function,
140    ) -> Result<i32, JsValue>;
141    #[cfg(not(web_sys_unstable_apis))]
142    #[wasm_bindgen(catch, method, js_class = "Geolocation", js_name = "watchPosition")]
143    #[doc = "The `watchPosition()` method."]
144    #[doc = ""]
145    #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/Geolocation/watchPosition)"]
146    #[doc = ""]
147    #[doc = "*This API requires the following crate features to be activated: `Geolocation`*"]
148    pub fn watch_position_with_error_callback(
149        this: &Geolocation,
150        success_callback: &::js_sys::Function,
151        error_callback: Option<&::js_sys::Function>,
152    ) -> Result<i32, JsValue>;
153    #[cfg(not(web_sys_unstable_apis))]
154    #[cfg(feature = "PositionOptions")]
155    #[wasm_bindgen(catch, method, js_class = "Geolocation", js_name = "watchPosition")]
156    #[doc = "The `watchPosition()` method."]
157    #[doc = ""]
158    #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/Geolocation/watchPosition)"]
159    #[doc = ""]
160    #[doc = "*This API requires the following crate features to be activated: `Geolocation`, `PositionOptions`*"]
161    pub fn watch_position_with_error_callback_and_options(
162        this: &Geolocation,
163        success_callback: &::js_sys::Function,
164        error_callback: Option<&::js_sys::Function>,
165        options: &PositionOptions,
166    ) -> Result<i32, JsValue>;
167    #[cfg(web_sys_unstable_apis)]
168    #[cfg(feature = "GeolocationPosition")]
169    #[wasm_bindgen(method, js_class = "Geolocation", js_name = "watchPosition")]
170    #[doc = "The `watchPosition()` method."]
171    #[doc = ""]
172    #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/Geolocation/watchPosition)"]
173    #[doc = ""]
174    #[doc = "*This API requires the following crate features to be activated: `Geolocation`, `GeolocationPosition`*"]
175    #[doc = ""]
176    #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"]
177    #[doc = "[described in the `wasm-bindgen` guide](https://wasm-bindgen.github.io/wasm-bindgen/web-sys/unstable-apis.html)*"]
178    pub fn watch_position(
179        this: &Geolocation,
180        success_callback: &::js_sys::Function<fn(GeolocationPosition) -> ::js_sys::Undefined>,
181    ) -> i32;
182    #[cfg(web_sys_unstable_apis)]
183    #[cfg(all(feature = "GeolocationPosition", feature = "GeolocationPositionError",))]
184    #[wasm_bindgen(method, js_class = "Geolocation", js_name = "watchPosition")]
185    #[doc = "The `watchPosition()` method."]
186    #[doc = ""]
187    #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/Geolocation/watchPosition)"]
188    #[doc = ""]
189    #[doc = "*This API requires the following crate features to be activated: `Geolocation`, `GeolocationPosition`, `GeolocationPositionError`*"]
190    #[doc = ""]
191    #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"]
192    #[doc = "[described in the `wasm-bindgen` guide](https://wasm-bindgen.github.io/wasm-bindgen/web-sys/unstable-apis.html)*"]
193    pub fn watch_position_with_error_callback(
194        this: &Geolocation,
195        success_callback: &::js_sys::Function<fn(GeolocationPosition) -> ::js_sys::Undefined>,
196        error_callback: Option<
197            &::js_sys::Function<fn(GeolocationPositionError) -> ::js_sys::Undefined>,
198        >,
199    ) -> i32;
200    #[cfg(web_sys_unstable_apis)]
201    #[cfg(all(
202        feature = "GeolocationPosition",
203        feature = "GeolocationPositionError",
204        feature = "PositionOptions",
205    ))]
206    #[wasm_bindgen(method, js_class = "Geolocation", js_name = "watchPosition")]
207    #[doc = "The `watchPosition()` method."]
208    #[doc = ""]
209    #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/Geolocation/watchPosition)"]
210    #[doc = ""]
211    #[doc = "*This API requires the following crate features to be activated: `Geolocation`, `GeolocationPosition`, `GeolocationPositionError`, `PositionOptions`*"]
212    #[doc = ""]
213    #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"]
214    #[doc = "[described in the `wasm-bindgen` guide](https://wasm-bindgen.github.io/wasm-bindgen/web-sys/unstable-apis.html)*"]
215    pub fn watch_position_with_error_callback_and_options(
216        this: &Geolocation,
217        success_callback: &::js_sys::Function<fn(GeolocationPosition) -> ::js_sys::Undefined>,
218        error_callback: Option<
219            &::js_sys::Function<fn(GeolocationPositionError) -> ::js_sys::Undefined>,
220        >,
221        options: &PositionOptions,
222    ) -> i32;
223}