github.com/primecitizens/pcz/std@v0.2.1/plat/js/webext/accessibilityfeatures/bindings/ffi_bindings.ts (about) 1 import { importModule, Application, heap, Pointer } from "@ffi"; 2 3 importModule("plat/js/webext/accessibilityfeatures", (A: Application) => { 4 const WEBEXT = typeof globalThis.browser === "undefined" ? globalThis.chrome : globalThis.browser; 5 6 return { 7 "get_AnimationPolicy": (retPtr: Pointer): heap.Ref<boolean> => { 8 if (WEBEXT?.accessibilityFeatures && "animationPolicy" in WEBEXT?.accessibilityFeatures) { 9 const val = WEBEXT.accessibilityFeatures.animationPolicy; 10 A.store.Ref(retPtr, val); 11 return A.H.TRUE; 12 } 13 14 return A.H.FALSE; 15 }, 16 "set_AnimationPolicy": (val: heap.Ref<object>): heap.Ref<boolean> => { 17 return Reflect.set( 18 WEBEXT.accessibilityFeatures, 19 "animationPolicy", 20 A.H.get<object>(val), 21 WEBEXT.accessibilityFeatures 22 ) 23 ? A.H.TRUE 24 : A.H.FALSE; 25 }, 26 "get_Autoclick": (retPtr: Pointer): heap.Ref<boolean> => { 27 if (WEBEXT?.accessibilityFeatures && "autoclick" in WEBEXT?.accessibilityFeatures) { 28 const val = WEBEXT.accessibilityFeatures.autoclick; 29 A.store.Ref(retPtr, val); 30 return A.H.TRUE; 31 } 32 33 return A.H.FALSE; 34 }, 35 "set_Autoclick": (val: heap.Ref<object>): heap.Ref<boolean> => { 36 return Reflect.set(WEBEXT.accessibilityFeatures, "autoclick", A.H.get<object>(val), WEBEXT.accessibilityFeatures) 37 ? A.H.TRUE 38 : A.H.FALSE; 39 }, 40 "get_CaretHighlight": (retPtr: Pointer): heap.Ref<boolean> => { 41 if (WEBEXT?.accessibilityFeatures && "caretHighlight" in WEBEXT?.accessibilityFeatures) { 42 const val = WEBEXT.accessibilityFeatures.caretHighlight; 43 A.store.Ref(retPtr, val); 44 return A.H.TRUE; 45 } 46 47 return A.H.FALSE; 48 }, 49 "set_CaretHighlight": (val: heap.Ref<object>): heap.Ref<boolean> => { 50 return Reflect.set( 51 WEBEXT.accessibilityFeatures, 52 "caretHighlight", 53 A.H.get<object>(val), 54 WEBEXT.accessibilityFeatures 55 ) 56 ? A.H.TRUE 57 : A.H.FALSE; 58 }, 59 "get_CursorColor": (retPtr: Pointer): heap.Ref<boolean> => { 60 if (WEBEXT?.accessibilityFeatures && "cursorColor" in WEBEXT?.accessibilityFeatures) { 61 const val = WEBEXT.accessibilityFeatures.cursorColor; 62 A.store.Ref(retPtr, val); 63 return A.H.TRUE; 64 } 65 66 return A.H.FALSE; 67 }, 68 "set_CursorColor": (val: heap.Ref<object>): heap.Ref<boolean> => { 69 return Reflect.set( 70 WEBEXT.accessibilityFeatures, 71 "cursorColor", 72 A.H.get<object>(val), 73 WEBEXT.accessibilityFeatures 74 ) 75 ? A.H.TRUE 76 : A.H.FALSE; 77 }, 78 "get_CursorHighlight": (retPtr: Pointer): heap.Ref<boolean> => { 79 if (WEBEXT?.accessibilityFeatures && "cursorHighlight" in WEBEXT?.accessibilityFeatures) { 80 const val = WEBEXT.accessibilityFeatures.cursorHighlight; 81 A.store.Ref(retPtr, val); 82 return A.H.TRUE; 83 } 84 85 return A.H.FALSE; 86 }, 87 "set_CursorHighlight": (val: heap.Ref<object>): heap.Ref<boolean> => { 88 return Reflect.set( 89 WEBEXT.accessibilityFeatures, 90 "cursorHighlight", 91 A.H.get<object>(val), 92 WEBEXT.accessibilityFeatures 93 ) 94 ? A.H.TRUE 95 : A.H.FALSE; 96 }, 97 "get_Dictation": (retPtr: Pointer): heap.Ref<boolean> => { 98 if (WEBEXT?.accessibilityFeatures && "dictation" in WEBEXT?.accessibilityFeatures) { 99 const val = WEBEXT.accessibilityFeatures.dictation; 100 A.store.Ref(retPtr, val); 101 return A.H.TRUE; 102 } 103 104 return A.H.FALSE; 105 }, 106 "set_Dictation": (val: heap.Ref<object>): heap.Ref<boolean> => { 107 return Reflect.set(WEBEXT.accessibilityFeatures, "dictation", A.H.get<object>(val), WEBEXT.accessibilityFeatures) 108 ? A.H.TRUE 109 : A.H.FALSE; 110 }, 111 "get_DockedMagnifier": (retPtr: Pointer): heap.Ref<boolean> => { 112 if (WEBEXT?.accessibilityFeatures && "dockedMagnifier" in WEBEXT?.accessibilityFeatures) { 113 const val = WEBEXT.accessibilityFeatures.dockedMagnifier; 114 A.store.Ref(retPtr, val); 115 return A.H.TRUE; 116 } 117 118 return A.H.FALSE; 119 }, 120 "set_DockedMagnifier": (val: heap.Ref<object>): heap.Ref<boolean> => { 121 return Reflect.set( 122 WEBEXT.accessibilityFeatures, 123 "dockedMagnifier", 124 A.H.get<object>(val), 125 WEBEXT.accessibilityFeatures 126 ) 127 ? A.H.TRUE 128 : A.H.FALSE; 129 }, 130 "get_FocusHighlight": (retPtr: Pointer): heap.Ref<boolean> => { 131 if (WEBEXT?.accessibilityFeatures && "focusHighlight" in WEBEXT?.accessibilityFeatures) { 132 const val = WEBEXT.accessibilityFeatures.focusHighlight; 133 A.store.Ref(retPtr, val); 134 return A.H.TRUE; 135 } 136 137 return A.H.FALSE; 138 }, 139 "set_FocusHighlight": (val: heap.Ref<object>): heap.Ref<boolean> => { 140 return Reflect.set( 141 WEBEXT.accessibilityFeatures, 142 "focusHighlight", 143 A.H.get<object>(val), 144 WEBEXT.accessibilityFeatures 145 ) 146 ? A.H.TRUE 147 : A.H.FALSE; 148 }, 149 "get_HighContrast": (retPtr: Pointer): heap.Ref<boolean> => { 150 if (WEBEXT?.accessibilityFeatures && "highContrast" in WEBEXT?.accessibilityFeatures) { 151 const val = WEBEXT.accessibilityFeatures.highContrast; 152 A.store.Ref(retPtr, val); 153 return A.H.TRUE; 154 } 155 156 return A.H.FALSE; 157 }, 158 "set_HighContrast": (val: heap.Ref<object>): heap.Ref<boolean> => { 159 return Reflect.set( 160 WEBEXT.accessibilityFeatures, 161 "highContrast", 162 A.H.get<object>(val), 163 WEBEXT.accessibilityFeatures 164 ) 165 ? A.H.TRUE 166 : A.H.FALSE; 167 }, 168 "get_LargeCursor": (retPtr: Pointer): heap.Ref<boolean> => { 169 if (WEBEXT?.accessibilityFeatures && "largeCursor" in WEBEXT?.accessibilityFeatures) { 170 const val = WEBEXT.accessibilityFeatures.largeCursor; 171 A.store.Ref(retPtr, val); 172 return A.H.TRUE; 173 } 174 175 return A.H.FALSE; 176 }, 177 "set_LargeCursor": (val: heap.Ref<object>): heap.Ref<boolean> => { 178 return Reflect.set( 179 WEBEXT.accessibilityFeatures, 180 "largeCursor", 181 A.H.get<object>(val), 182 WEBEXT.accessibilityFeatures 183 ) 184 ? A.H.TRUE 185 : A.H.FALSE; 186 }, 187 "get_ScreenMagnifier": (retPtr: Pointer): heap.Ref<boolean> => { 188 if (WEBEXT?.accessibilityFeatures && "screenMagnifier" in WEBEXT?.accessibilityFeatures) { 189 const val = WEBEXT.accessibilityFeatures.screenMagnifier; 190 A.store.Ref(retPtr, val); 191 return A.H.TRUE; 192 } 193 194 return A.H.FALSE; 195 }, 196 "set_ScreenMagnifier": (val: heap.Ref<object>): heap.Ref<boolean> => { 197 return Reflect.set( 198 WEBEXT.accessibilityFeatures, 199 "screenMagnifier", 200 A.H.get<object>(val), 201 WEBEXT.accessibilityFeatures 202 ) 203 ? A.H.TRUE 204 : A.H.FALSE; 205 }, 206 "get_SelectToSpeak": (retPtr: Pointer): heap.Ref<boolean> => { 207 if (WEBEXT?.accessibilityFeatures && "selectToSpeak" in WEBEXT?.accessibilityFeatures) { 208 const val = WEBEXT.accessibilityFeatures.selectToSpeak; 209 A.store.Ref(retPtr, val); 210 return A.H.TRUE; 211 } 212 213 return A.H.FALSE; 214 }, 215 "set_SelectToSpeak": (val: heap.Ref<object>): heap.Ref<boolean> => { 216 return Reflect.set( 217 WEBEXT.accessibilityFeatures, 218 "selectToSpeak", 219 A.H.get<object>(val), 220 WEBEXT.accessibilityFeatures 221 ) 222 ? A.H.TRUE 223 : A.H.FALSE; 224 }, 225 "get_SpokenFeedback": (retPtr: Pointer): heap.Ref<boolean> => { 226 if (WEBEXT?.accessibilityFeatures && "spokenFeedback" in WEBEXT?.accessibilityFeatures) { 227 const val = WEBEXT.accessibilityFeatures.spokenFeedback; 228 A.store.Ref(retPtr, val); 229 return A.H.TRUE; 230 } 231 232 return A.H.FALSE; 233 }, 234 "set_SpokenFeedback": (val: heap.Ref<object>): heap.Ref<boolean> => { 235 return Reflect.set( 236 WEBEXT.accessibilityFeatures, 237 "spokenFeedback", 238 A.H.get<object>(val), 239 WEBEXT.accessibilityFeatures 240 ) 241 ? A.H.TRUE 242 : A.H.FALSE; 243 }, 244 "get_StickyKeys": (retPtr: Pointer): heap.Ref<boolean> => { 245 if (WEBEXT?.accessibilityFeatures && "stickyKeys" in WEBEXT?.accessibilityFeatures) { 246 const val = WEBEXT.accessibilityFeatures.stickyKeys; 247 A.store.Ref(retPtr, val); 248 return A.H.TRUE; 249 } 250 251 return A.H.FALSE; 252 }, 253 "set_StickyKeys": (val: heap.Ref<object>): heap.Ref<boolean> => { 254 return Reflect.set(WEBEXT.accessibilityFeatures, "stickyKeys", A.H.get<object>(val), WEBEXT.accessibilityFeatures) 255 ? A.H.TRUE 256 : A.H.FALSE; 257 }, 258 "get_SwitchAccess": (retPtr: Pointer): heap.Ref<boolean> => { 259 if (WEBEXT?.accessibilityFeatures && "switchAccess" in WEBEXT?.accessibilityFeatures) { 260 const val = WEBEXT.accessibilityFeatures.switchAccess; 261 A.store.Ref(retPtr, val); 262 return A.H.TRUE; 263 } 264 265 return A.H.FALSE; 266 }, 267 "set_SwitchAccess": (val: heap.Ref<object>): heap.Ref<boolean> => { 268 return Reflect.set( 269 WEBEXT.accessibilityFeatures, 270 "switchAccess", 271 A.H.get<object>(val), 272 WEBEXT.accessibilityFeatures 273 ) 274 ? A.H.TRUE 275 : A.H.FALSE; 276 }, 277 "get_VirtualKeyboard": (retPtr: Pointer): heap.Ref<boolean> => { 278 if (WEBEXT?.accessibilityFeatures && "virtualKeyboard" in WEBEXT?.accessibilityFeatures) { 279 const val = WEBEXT.accessibilityFeatures.virtualKeyboard; 280 A.store.Ref(retPtr, val); 281 return A.H.TRUE; 282 } 283 284 return A.H.FALSE; 285 }, 286 "set_VirtualKeyboard": (val: heap.Ref<object>): heap.Ref<boolean> => { 287 return Reflect.set( 288 WEBEXT.accessibilityFeatures, 289 "virtualKeyboard", 290 A.H.get<object>(val), 291 WEBEXT.accessibilityFeatures 292 ) 293 ? A.H.TRUE 294 : A.H.FALSE; 295 }, 296 }; 297 });