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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
use super::*;
/// The FontFaceSet class.
/// [`FontFaceSet`](https://developer.mozilla.org/en-US/docs/Web/API/FontFaceSet)
#[derive(Clone, Debug, PartialEq, PartialOrd)]
#[repr(transparent)]
pub struct FontFaceSet {
inner: EventTarget,
}
impl FromVal for FontFaceSet {
fn from_val(v: &Any) -> Self {
FontFaceSet {
inner: EventTarget::from_val(v),
}
}
fn take_ownership(v: AnyHandle) -> Self {
Self::from_val(&Any::take_ownership(v))
}
fn as_handle(&self) -> AnyHandle {
self.inner.as_handle()
}
}
impl core::ops::Deref for FontFaceSet {
type Target = EventTarget;
fn deref(&self) -> &Self::Target {
&self.inner
}
}
impl core::ops::DerefMut for FontFaceSet {
fn deref_mut(&mut self) -> &mut Self::Target {
&mut self.inner
}
}
impl AsRef<Any> for FontFaceSet {
fn as_ref(&self) -> &Any {
&self.inner
}
}
impl AsMut<Any> for FontFaceSet {
fn as_mut(&mut self) -> &mut Any {
&mut self.inner
}
}
impl From<FontFaceSet> for Any {
fn from(s: FontFaceSet) -> Any {
let handle = s.inner.as_handle();
core::mem::forget(s);
Any::take_ownership(handle)
}
}
impl From<&FontFaceSet> for Any {
fn from(s: &FontFaceSet) -> Any {
s.inner.clone().into()
}
}
jsbind::utils::impl_dyn_cast!(FontFaceSet);
impl FontFaceSet {
/// Getter of the `onloading` attribute.
/// [`FontFaceSet.onloading`](https://developer.mozilla.org/en-US/docs/Web/API/FontFaceSet/onloading)
pub fn onloading(&self) -> Any {
self.inner.get("onloading").as_::<Any>()
}
/// Setter of the `onloading` attribute.
/// [`FontFaceSet.onloading`](https://developer.mozilla.org/en-US/docs/Web/API/FontFaceSet/onloading)
pub fn set_onloading(&mut self, value: &Any) {
self.inner.set("onloading", value);
}
}
impl FontFaceSet {
/// Getter of the `onloadingdone` attribute.
/// [`FontFaceSet.onloadingdone`](https://developer.mozilla.org/en-US/docs/Web/API/FontFaceSet/onloadingdone)
pub fn onloadingdone(&self) -> Any {
self.inner.get("onloadingdone").as_::<Any>()
}
/// Setter of the `onloadingdone` attribute.
/// [`FontFaceSet.onloadingdone`](https://developer.mozilla.org/en-US/docs/Web/API/FontFaceSet/onloadingdone)
pub fn set_onloadingdone(&mut self, value: &Any) {
self.inner.set("onloadingdone", value);
}
}
impl FontFaceSet {
/// Getter of the `onloadingerror` attribute.
/// [`FontFaceSet.onloadingerror`](https://developer.mozilla.org/en-US/docs/Web/API/FontFaceSet/onloadingerror)
pub fn onloadingerror(&self) -> Any {
self.inner.get("onloadingerror").as_::<Any>()
}
/// Setter of the `onloadingerror` attribute.
/// [`FontFaceSet.onloadingerror`](https://developer.mozilla.org/en-US/docs/Web/API/FontFaceSet/onloadingerror)
pub fn set_onloadingerror(&mut self, value: &Any) {
self.inner.set("onloadingerror", value);
}
}
impl FontFaceSet {
/// Getter of the `ready` attribute.
/// [`FontFaceSet.ready`](https://developer.mozilla.org/en-US/docs/Web/API/FontFaceSet/ready)
pub fn ready(&self) -> Promise<FontFaceSet> {
self.inner.get("ready").as_::<Promise<FontFaceSet>>()
}
}
impl FontFaceSet {
/// Getter of the `status` attribute.
/// [`FontFaceSet.status`](https://developer.mozilla.org/en-US/docs/Web/API/FontFaceSet/status)
pub fn status(&self) -> FontFaceSetLoadStatus {
self.inner.get("status").as_::<FontFaceSetLoadStatus>()
}
}
impl FontFaceSet {
/// The add method.
/// [`FontFaceSet.add`](https://developer.mozilla.org/en-US/docs/Web/API/FontFaceSet/add)
pub fn add(&self, font: &FontFace) -> FontFaceSet {
self.inner.call("add", &[font.into()]).as_::<FontFaceSet>()
}
}
impl FontFaceSet {
/// The delete method.
/// [`FontFaceSet.delete`](https://developer.mozilla.org/en-US/docs/Web/API/FontFaceSet/delete)
pub fn delete(&self, font: &FontFace) -> bool {
self.inner.call("delete", &[font.into()]).as_::<bool>()
}
}
impl FontFaceSet {
/// The clear method.
/// [`FontFaceSet.clear`](https://developer.mozilla.org/en-US/docs/Web/API/FontFaceSet/clear)
pub fn clear(&self) -> Undefined {
self.inner.call("clear", &[]).as_::<Undefined>()
}
}
impl FontFaceSet {
/// The load method.
/// [`FontFaceSet.load`](https://developer.mozilla.org/en-US/docs/Web/API/FontFaceSet/load)
pub fn load(&self, font: &JsString) -> Promise<TypedArray<FontFace>> {
self.inner
.call("load", &[font.into()])
.as_::<Promise<TypedArray<FontFace>>>()
}
}
impl FontFaceSet {
/// The load method.
/// [`FontFaceSet.load`](https://developer.mozilla.org/en-US/docs/Web/API/FontFaceSet/load)
pub fn load_with_text(
&self,
font: &JsString,
text: &JsString,
) -> Promise<TypedArray<FontFace>> {
self.inner
.call("load", &[font.into(), text.into()])
.as_::<Promise<TypedArray<FontFace>>>()
}
}
impl FontFaceSet {
/// The check method.
/// [`FontFaceSet.check`](https://developer.mozilla.org/en-US/docs/Web/API/FontFaceSet/check)
pub fn check(&self, font: &JsString) -> bool {
self.inner.call("check", &[font.into()]).as_::<bool>()
}
}
impl FontFaceSet {
/// The check method.
/// [`FontFaceSet.check`](https://developer.mozilla.org/en-US/docs/Web/API/FontFaceSet/check)
pub fn check_with_text(&self, font: &JsString, text: &JsString) -> bool {
self.inner
.call("check", &[font.into(), text.into()])
.as_::<bool>()
}
}