github.com/primecitizens/pcz/std@v0.2.1/plat/js/webext/sessions/bindings/ffi_bindings.ts (about) 1 import { importModule, Application, heap, Pointer } from "@ffi"; 2 3 importModule("plat/js/webext/sessions", (A: Application) => { 4 const WEBEXT = typeof globalThis.browser === "undefined" ? globalThis.chrome : globalThis.browser; 5 6 return { 7 "store_Session": (ptr: Pointer, ref: heap.Ref<any>) => { 8 const x = A.H.get<any>(ref); 9 10 if (typeof x === "undefined") { 11 A.store.Bool(ptr + 222, false); 12 A.store.Int64(ptr + 0, 0); 13 14 A.store.Bool(ptr + 8 + 0, false); 15 A.store.Bool(ptr + 8 + 0, false); 16 A.store.Bool(ptr + 8 + 0, false); 17 A.store.Bool(ptr + 8 + 0, false); 18 A.store.Bool(ptr + 8 + 0, false); 19 A.store.Bool(ptr + 8 + 0, false); 20 A.store.Ref(ptr + 8 + 0, undefined); 21 A.store.Int0(ptr + 8 + 0, 0); 22 A.store.Bool(ptr + 8 + 0, false); 23 A.store.Int0(ptr + 8 + 0, 0); 24 A.store.Bool(ptr + 8 + 0, false); 25 A.store.Bool(ptr + 8 + 0, false); 26 A.store.Int0(ptr + 8 + 0, 0); 27 A.store.Bool(ptr + 8 + 0, false); 28 A.store.Int0(ptr + 8 + 0, 0); 29 30 A.store.Bool(ptr + 8 + 0 + 0, false); 31 A.store.Ref(ptr + 8 + 0 + 0, undefined); 32 A.store.Bool(ptr + 8 + 0 + 0, false); 33 A.store.Enum(ptr + 8 + 0 + 0, -1); 34 A.store.Bool(ptr + 8 + 0, false); 35 A.store.Int0(ptr + 8 + 0, 0); 36 A.store.Ref(ptr + 8 + 0, undefined); 37 A.store.Bool(ptr + 8 + 0, false); 38 A.store.Bool(ptr + 8 + 0, false); 39 A.store.Ref(ptr + 8 + 0, undefined); 40 A.store.Enum(ptr + 8 + 0, -1); 41 A.store.Ref(ptr + 8 + 0, undefined); 42 A.store.Ref(ptr + 8 + 0, undefined); 43 A.store.Bool(ptr + 8 + 0, false); 44 A.store.Int0(ptr + 8 + 0, 0); 45 A.store.Int0(ptr + 8 + 0, 0); 46 47 A.store.Bool(ptr + 136 + 0, false); 48 A.store.Bool(ptr + 136 + 0, false); 49 A.store.Bool(ptr + 136 + 0, false); 50 A.store.Bool(ptr + 136 + 0, false); 51 A.store.Int0(ptr + 136 + 0, 0); 52 A.store.Bool(ptr + 136 + 0, false); 53 A.store.Int0(ptr + 136 + 0, 0); 54 A.store.Bool(ptr + 136 + 0, false); 55 A.store.Bool(ptr + 136 + 0, false); 56 A.store.Int0(ptr + 136 + 0, 0); 57 A.store.Ref(ptr + 136 + 0, undefined); 58 A.store.Enum(ptr + 136 + 0, -1); 59 A.store.Ref(ptr + 136 + 0, undefined); 60 A.store.Bool(ptr + 136 + 0, false); 61 A.store.Int0(ptr + 136 + 0, 0); 62 A.store.Enum(ptr + 136 + 0, -1); 63 A.store.Bool(ptr + 136 + 0, false); 64 A.store.Int0(ptr + 136 + 0, 0); 65 } else { 66 A.store.Bool(ptr + 222, true); 67 A.store.Int64(ptr + 0, x["lastModified"] === undefined ? 0 : (x["lastModified"] as number)); 68 69 if (typeof x["tab"] === "undefined") { 70 A.store.Bool(ptr + 8 + 0, false); 71 A.store.Bool(ptr + 8 + 0, false); 72 A.store.Bool(ptr + 8 + 0, false); 73 A.store.Bool(ptr + 8 + 0, false); 74 A.store.Bool(ptr + 8 + 0, false); 75 A.store.Bool(ptr + 8 + 0, false); 76 A.store.Ref(ptr + 8 + 0, undefined); 77 A.store.Int0(ptr + 8 + 0, 0); 78 A.store.Bool(ptr + 8 + 0, false); 79 A.store.Int0(ptr + 8 + 0, 0); 80 A.store.Bool(ptr + 8 + 0, false); 81 A.store.Bool(ptr + 8 + 0, false); 82 A.store.Int0(ptr + 8 + 0, 0); 83 A.store.Bool(ptr + 8 + 0, false); 84 A.store.Int0(ptr + 8 + 0, 0); 85 86 A.store.Bool(ptr + 8 + 0 + 0, false); 87 A.store.Ref(ptr + 8 + 0 + 0, undefined); 88 A.store.Bool(ptr + 8 + 0 + 0, false); 89 A.store.Enum(ptr + 8 + 0 + 0, -1); 90 A.store.Bool(ptr + 8 + 0, false); 91 A.store.Int0(ptr + 8 + 0, 0); 92 A.store.Ref(ptr + 8 + 0, undefined); 93 A.store.Bool(ptr + 8 + 0, false); 94 A.store.Bool(ptr + 8 + 0, false); 95 A.store.Ref(ptr + 8 + 0, undefined); 96 A.store.Enum(ptr + 8 + 0, -1); 97 A.store.Ref(ptr + 8 + 0, undefined); 98 A.store.Ref(ptr + 8 + 0, undefined); 99 A.store.Bool(ptr + 8 + 0, false); 100 A.store.Int0(ptr + 8 + 0, 0); 101 A.store.Int0(ptr + 8 + 0, 0); 102 } else { 103 A.store.Bool(ptr + 8 + 0, true); 104 A.store.Bool(ptr + 8 + 0, x["tab"]["active"] ? true : false); 105 A.store.Bool(ptr + 8 + 0, "audible" in x["tab"] ? true : false); 106 A.store.Bool(ptr + 8 + 0, x["tab"]["audible"] ? true : false); 107 A.store.Bool(ptr + 8 + 0, x["tab"]["autoDiscardable"] ? true : false); 108 A.store.Bool(ptr + 8 + 0, x["tab"]["discarded"] ? true : false); 109 A.store.Ref(ptr + 8 + 0, x["tab"]["favIconUrl"]); 110 A.store.Int0(ptr + 8 + 0, x["tab"]["groupId"] === undefined ? 0 : (x["tab"]["groupId"] as number)); 111 A.store.Bool(ptr + 8 + 0, "height" in x["tab"] ? true : false); 112 A.store.Int0(ptr + 8 + 0, x["tab"]["height"] === undefined ? 0 : (x["tab"]["height"] as number)); 113 A.store.Bool(ptr + 8 + 0, x["tab"]["highlighted"] ? true : false); 114 A.store.Bool(ptr + 8 + 0, "id" in x["tab"] ? true : false); 115 A.store.Int0(ptr + 8 + 0, x["tab"]["id"] === undefined ? 0 : (x["tab"]["id"] as number)); 116 A.store.Bool(ptr + 8 + 0, x["tab"]["incognito"] ? true : false); 117 A.store.Int0(ptr + 8 + 0, x["tab"]["index"] === undefined ? 0 : (x["tab"]["index"] as number)); 118 119 if (typeof x["tab"]["mutedInfo"] === "undefined") { 120 A.store.Bool(ptr + 8 + 0 + 0, false); 121 A.store.Ref(ptr + 8 + 0 + 0, undefined); 122 A.store.Bool(ptr + 8 + 0 + 0, false); 123 A.store.Enum(ptr + 8 + 0 + 0, -1); 124 } else { 125 A.store.Bool(ptr + 8 + 0 + 0, true); 126 A.store.Ref(ptr + 8 + 0 + 0, x["tab"]["mutedInfo"]["extensionId"]); 127 A.store.Bool(ptr + 8 + 0 + 0, x["tab"]["mutedInfo"]["muted"] ? true : false); 128 A.store.Enum( 129 ptr + 8 + 0 + 0, 130 ["user", "capture", "extension"].indexOf(x["tab"]["mutedInfo"]["reason"] as string) 131 ); 132 } 133 A.store.Bool(ptr + 8 + 0, "openerTabId" in x["tab"] ? true : false); 134 A.store.Int0(ptr + 8 + 0, x["tab"]["openerTabId"] === undefined ? 0 : (x["tab"]["openerTabId"] as number)); 135 A.store.Ref(ptr + 8 + 0, x["tab"]["pendingUrl"]); 136 A.store.Bool(ptr + 8 + 0, x["tab"]["pinned"] ? true : false); 137 A.store.Bool(ptr + 8 + 0, x["tab"]["selected"] ? true : false); 138 A.store.Ref(ptr + 8 + 0, x["tab"]["sessionId"]); 139 A.store.Enum(ptr + 8 + 0, ["unloaded", "loading", "complete"].indexOf(x["tab"]["status"] as string)); 140 A.store.Ref(ptr + 8 + 0, x["tab"]["title"]); 141 A.store.Ref(ptr + 8 + 0, x["tab"]["url"]); 142 A.store.Bool(ptr + 8 + 0, "width" in x["tab"] ? true : false); 143 A.store.Int0(ptr + 8 + 0, x["tab"]["width"] === undefined ? 0 : (x["tab"]["width"] as number)); 144 A.store.Int0(ptr + 8 + 0, x["tab"]["windowId"] === undefined ? 0 : (x["tab"]["windowId"] as number)); 145 } 146 147 if (typeof x["window"] === "undefined") { 148 A.store.Bool(ptr + 136 + 0, false); 149 A.store.Bool(ptr + 136 + 0, false); 150 A.store.Bool(ptr + 136 + 0, false); 151 A.store.Bool(ptr + 136 + 0, false); 152 A.store.Int0(ptr + 136 + 0, 0); 153 A.store.Bool(ptr + 136 + 0, false); 154 A.store.Int0(ptr + 136 + 0, 0); 155 A.store.Bool(ptr + 136 + 0, false); 156 A.store.Bool(ptr + 136 + 0, false); 157 A.store.Int0(ptr + 136 + 0, 0); 158 A.store.Ref(ptr + 136 + 0, undefined); 159 A.store.Enum(ptr + 136 + 0, -1); 160 A.store.Ref(ptr + 136 + 0, undefined); 161 A.store.Bool(ptr + 136 + 0, false); 162 A.store.Int0(ptr + 136 + 0, 0); 163 A.store.Enum(ptr + 136 + 0, -1); 164 A.store.Bool(ptr + 136 + 0, false); 165 A.store.Int0(ptr + 136 + 0, 0); 166 } else { 167 A.store.Bool(ptr + 136 + 0, true); 168 A.store.Bool(ptr + 136 + 0, x["window"]["alwaysOnTop"] ? true : false); 169 A.store.Bool(ptr + 136 + 0, x["window"]["focused"] ? true : false); 170 A.store.Bool(ptr + 136 + 0, "height" in x["window"] ? true : false); 171 A.store.Int0(ptr + 136 + 0, x["window"]["height"] === undefined ? 0 : (x["window"]["height"] as number)); 172 A.store.Bool(ptr + 136 + 0, "id" in x["window"] ? true : false); 173 A.store.Int0(ptr + 136 + 0, x["window"]["id"] === undefined ? 0 : (x["window"]["id"] as number)); 174 A.store.Bool(ptr + 136 + 0, x["window"]["incognito"] ? true : false); 175 A.store.Bool(ptr + 136 + 0, "left" in x["window"] ? true : false); 176 A.store.Int0(ptr + 136 + 0, x["window"]["left"] === undefined ? 0 : (x["window"]["left"] as number)); 177 A.store.Ref(ptr + 136 + 0, x["window"]["sessionId"]); 178 A.store.Enum( 179 ptr + 136 + 0, 180 ["normal", "minimized", "maximized", "fullscreen", "locked-fullscreen"].indexOf( 181 x["window"]["state"] as string 182 ) 183 ); 184 A.store.Ref(ptr + 136 + 0, x["window"]["tabs"]); 185 A.store.Bool(ptr + 136 + 0, "top" in x["window"] ? true : false); 186 A.store.Int0(ptr + 136 + 0, x["window"]["top"] === undefined ? 0 : (x["window"]["top"] as number)); 187 A.store.Enum( 188 ptr + 136 + 0, 189 ["normal", "popup", "panel", "app", "devtools"].indexOf(x["window"]["type"] as string) 190 ); 191 A.store.Bool(ptr + 136 + 0, "width" in x["window"] ? true : false); 192 A.store.Int0(ptr + 136 + 0, x["window"]["width"] === undefined ? 0 : (x["window"]["width"] as number)); 193 } 194 } 195 }, 196 "load_Session": (ptr: Pointer, create: heap.Ref<boolean>, ref: heap.Ref<any>): heap.Ref<any> => { 197 const x = create === A.H.TRUE ? {} : A.H.get<any>(ref); 198 199 x["lastModified"] = A.load.Int64(ptr + 0); 200 if (A.load.Bool(ptr + 8 + 0)) { 201 x["tab"] = {}; 202 x["tab"]["active"] = A.load.Bool(ptr + 8 + 0); 203 if (A.load.Bool(ptr + 8 + 0)) { 204 x["tab"]["audible"] = A.load.Bool(ptr + 8 + 0); 205 } else { 206 delete x["tab"]["audible"]; 207 } 208 x["tab"]["autoDiscardable"] = A.load.Bool(ptr + 8 + 0); 209 x["tab"]["discarded"] = A.load.Bool(ptr + 8 + 0); 210 x["tab"]["favIconUrl"] = A.load.Ref(ptr + 8 + 0, undefined); 211 x["tab"]["groupId"] = A.load.Int0(ptr + 8 + 0); 212 if (A.load.Bool(ptr + 8 + 0)) { 213 x["tab"]["height"] = A.load.Int0(ptr + 8 + 0); 214 } else { 215 delete x["tab"]["height"]; 216 } 217 x["tab"]["highlighted"] = A.load.Bool(ptr + 8 + 0); 218 if (A.load.Bool(ptr + 8 + 0)) { 219 x["tab"]["id"] = A.load.Int0(ptr + 8 + 0); 220 } else { 221 delete x["tab"]["id"]; 222 } 223 x["tab"]["incognito"] = A.load.Bool(ptr + 8 + 0); 224 x["tab"]["index"] = A.load.Int0(ptr + 8 + 0); 225 if (A.load.Bool(ptr + 8 + 0 + 0)) { 226 x["tab"]["mutedInfo"] = {}; 227 x["tab"]["mutedInfo"]["extensionId"] = A.load.Ref(ptr + 8 + 0 + 0, undefined); 228 x["tab"]["mutedInfo"]["muted"] = A.load.Bool(ptr + 8 + 0 + 0); 229 x["tab"]["mutedInfo"]["reason"] = A.load.Enum(ptr + 8 + 0 + 0, ["user", "capture", "extension"]); 230 } else { 231 delete x["tab"]["mutedInfo"]; 232 } 233 if (A.load.Bool(ptr + 8 + 0)) { 234 x["tab"]["openerTabId"] = A.load.Int0(ptr + 8 + 0); 235 } else { 236 delete x["tab"]["openerTabId"]; 237 } 238 x["tab"]["pendingUrl"] = A.load.Ref(ptr + 8 + 0, undefined); 239 x["tab"]["pinned"] = A.load.Bool(ptr + 8 + 0); 240 x["tab"]["selected"] = A.load.Bool(ptr + 8 + 0); 241 x["tab"]["sessionId"] = A.load.Ref(ptr + 8 + 0, undefined); 242 x["tab"]["status"] = A.load.Enum(ptr + 8 + 0, ["unloaded", "loading", "complete"]); 243 x["tab"]["title"] = A.load.Ref(ptr + 8 + 0, undefined); 244 x["tab"]["url"] = A.load.Ref(ptr + 8 + 0, undefined); 245 if (A.load.Bool(ptr + 8 + 0)) { 246 x["tab"]["width"] = A.load.Int0(ptr + 8 + 0); 247 } else { 248 delete x["tab"]["width"]; 249 } 250 x["tab"]["windowId"] = A.load.Int0(ptr + 8 + 0); 251 } else { 252 delete x["tab"]; 253 } 254 if (A.load.Bool(ptr + 136 + 0)) { 255 x["window"] = {}; 256 x["window"]["alwaysOnTop"] = A.load.Bool(ptr + 136 + 0); 257 x["window"]["focused"] = A.load.Bool(ptr + 136 + 0); 258 if (A.load.Bool(ptr + 136 + 0)) { 259 x["window"]["height"] = A.load.Int0(ptr + 136 + 0); 260 } else { 261 delete x["window"]["height"]; 262 } 263 if (A.load.Bool(ptr + 136 + 0)) { 264 x["window"]["id"] = A.load.Int0(ptr + 136 + 0); 265 } else { 266 delete x["window"]["id"]; 267 } 268 x["window"]["incognito"] = A.load.Bool(ptr + 136 + 0); 269 if (A.load.Bool(ptr + 136 + 0)) { 270 x["window"]["left"] = A.load.Int0(ptr + 136 + 0); 271 } else { 272 delete x["window"]["left"]; 273 } 274 x["window"]["sessionId"] = A.load.Ref(ptr + 136 + 0, undefined); 275 x["window"]["state"] = A.load.Enum(ptr + 136 + 0, [ 276 "normal", 277 "minimized", 278 "maximized", 279 "fullscreen", 280 "locked-fullscreen", 281 ]); 282 x["window"]["tabs"] = A.load.Ref(ptr + 136 + 0, undefined); 283 if (A.load.Bool(ptr + 136 + 0)) { 284 x["window"]["top"] = A.load.Int0(ptr + 136 + 0); 285 } else { 286 delete x["window"]["top"]; 287 } 288 x["window"]["type"] = A.load.Enum(ptr + 136 + 0, ["normal", "popup", "panel", "app", "devtools"]); 289 if (A.load.Bool(ptr + 136 + 0)) { 290 x["window"]["width"] = A.load.Int0(ptr + 136 + 0); 291 } else { 292 delete x["window"]["width"]; 293 } 294 } else { 295 delete x["window"]; 296 } 297 return create === A.H.TRUE ? A.H.push(x) : ref; 298 }, 299 300 "store_Device": (ptr: Pointer, ref: heap.Ref<any>) => { 301 const x = A.H.get<any>(ref); 302 303 if (typeof x === "undefined") { 304 A.store.Bool(ptr + 12, false); 305 A.store.Ref(ptr + 0, undefined); 306 A.store.Ref(ptr + 4, undefined); 307 A.store.Ref(ptr + 8, undefined); 308 } else { 309 A.store.Bool(ptr + 12, true); 310 A.store.Ref(ptr + 0, x["deviceName"]); 311 A.store.Ref(ptr + 4, x["info"]); 312 A.store.Ref(ptr + 8, x["sessions"]); 313 } 314 }, 315 "load_Device": (ptr: Pointer, create: heap.Ref<boolean>, ref: heap.Ref<any>): heap.Ref<any> => { 316 const x = create === A.H.TRUE ? {} : A.H.get<any>(ref); 317 318 x["deviceName"] = A.load.Ref(ptr + 0, undefined); 319 x["info"] = A.load.Ref(ptr + 4, undefined); 320 x["sessions"] = A.load.Ref(ptr + 8, undefined); 321 return create === A.H.TRUE ? A.H.push(x) : ref; 322 }, 323 324 "store_Filter": (ptr: Pointer, ref: heap.Ref<any>) => { 325 const x = A.H.get<any>(ref); 326 327 if (typeof x === "undefined") { 328 A.store.Bool(ptr + 9, false); 329 A.store.Bool(ptr + 8, false); 330 A.store.Int64(ptr + 0, 0); 331 } else { 332 A.store.Bool(ptr + 9, true); 333 A.store.Bool(ptr + 8, "maxResults" in x ? true : false); 334 A.store.Int64(ptr + 0, x["maxResults"] === undefined ? 0 : (x["maxResults"] as number)); 335 } 336 }, 337 "load_Filter": (ptr: Pointer, create: heap.Ref<boolean>, ref: heap.Ref<any>): heap.Ref<any> => { 338 const x = create === A.H.TRUE ? {} : A.H.get<any>(ref); 339 340 if (A.load.Bool(ptr + 8)) { 341 x["maxResults"] = A.load.Int64(ptr + 0); 342 } else { 343 delete x["maxResults"]; 344 } 345 return create === A.H.TRUE ? A.H.push(x) : ref; 346 }, 347 "get_MAX_SESSION_RESULTS": (retPtr: Pointer): heap.Ref<boolean> => { 348 if (WEBEXT?.sessions && "MAX_SESSION_RESULTS" in WEBEXT?.sessions) { 349 const val = WEBEXT.sessions.MAX_SESSION_RESULTS; 350 A.store.Ref(retPtr, val); 351 return A.H.TRUE; 352 } 353 354 return A.H.FALSE; 355 }, 356 "set_MAX_SESSION_RESULTS": (val: heap.Ref<object>): heap.Ref<boolean> => { 357 return Reflect.set(WEBEXT.sessions, "MAX_SESSION_RESULTS", A.H.get<object>(val), WEBEXT.sessions) 358 ? A.H.TRUE 359 : A.H.FALSE; 360 }, 361 "has_GetDevices": (): heap.Ref<boolean> => { 362 if (WEBEXT?.sessions && "getDevices" in WEBEXT?.sessions) { 363 return A.H.TRUE; 364 } 365 return A.H.FALSE; 366 }, 367 "func_GetDevices": (fn: Pointer): void => { 368 A.store.Ref(fn, WEBEXT.sessions.getDevices); 369 }, 370 "call_GetDevices": (retPtr: Pointer, filter: Pointer): void => { 371 const filter_ffi = {}; 372 373 if (A.load.Bool(filter + 8)) { 374 filter_ffi["maxResults"] = A.load.Int64(filter + 0); 375 } 376 377 const _ret = WEBEXT.sessions.getDevices(filter_ffi); 378 A.store.Ref(retPtr, _ret); 379 }, 380 "try_GetDevices": (retPtr: Pointer, errPtr: Pointer, filter: Pointer): heap.Ref<boolean> => { 381 try { 382 const filter_ffi = {}; 383 384 if (A.load.Bool(filter + 8)) { 385 filter_ffi["maxResults"] = A.load.Int64(filter + 0); 386 } 387 388 const _ret = WEBEXT.sessions.getDevices(filter_ffi); 389 A.store.Ref(retPtr, _ret); 390 return A.H.TRUE; 391 } catch (err: any) { 392 A.store.Ref(errPtr, err); 393 return A.H.FALSE; 394 } 395 }, 396 "has_GetRecentlyClosed": (): heap.Ref<boolean> => { 397 if (WEBEXT?.sessions && "getRecentlyClosed" in WEBEXT?.sessions) { 398 return A.H.TRUE; 399 } 400 return A.H.FALSE; 401 }, 402 "func_GetRecentlyClosed": (fn: Pointer): void => { 403 A.store.Ref(fn, WEBEXT.sessions.getRecentlyClosed); 404 }, 405 "call_GetRecentlyClosed": (retPtr: Pointer, filter: Pointer): void => { 406 const filter_ffi = {}; 407 408 if (A.load.Bool(filter + 8)) { 409 filter_ffi["maxResults"] = A.load.Int64(filter + 0); 410 } 411 412 const _ret = WEBEXT.sessions.getRecentlyClosed(filter_ffi); 413 A.store.Ref(retPtr, _ret); 414 }, 415 "try_GetRecentlyClosed": (retPtr: Pointer, errPtr: Pointer, filter: Pointer): heap.Ref<boolean> => { 416 try { 417 const filter_ffi = {}; 418 419 if (A.load.Bool(filter + 8)) { 420 filter_ffi["maxResults"] = A.load.Int64(filter + 0); 421 } 422 423 const _ret = WEBEXT.sessions.getRecentlyClosed(filter_ffi); 424 A.store.Ref(retPtr, _ret); 425 return A.H.TRUE; 426 } catch (err: any) { 427 A.store.Ref(errPtr, err); 428 return A.H.FALSE; 429 } 430 }, 431 "has_OnChanged": (): heap.Ref<boolean> => { 432 if (WEBEXT?.sessions?.onChanged && "addListener" in WEBEXT?.sessions?.onChanged) { 433 return A.H.TRUE; 434 } 435 return A.H.FALSE; 436 }, 437 "func_OnChanged": (fn: Pointer): void => { 438 A.store.Ref(fn, WEBEXT.sessions.onChanged.addListener); 439 }, 440 "call_OnChanged": (retPtr: Pointer, callback: heap.Ref<object>): void => { 441 const _ret = WEBEXT.sessions.onChanged.addListener(A.H.get<object>(callback)); 442 }, 443 "try_OnChanged": (retPtr: Pointer, errPtr: Pointer, callback: heap.Ref<object>): heap.Ref<boolean> => { 444 try { 445 const _ret = WEBEXT.sessions.onChanged.addListener(A.H.get<object>(callback)); 446 return A.H.TRUE; 447 } catch (err: any) { 448 A.store.Ref(errPtr, err); 449 return A.H.FALSE; 450 } 451 }, 452 "has_OffChanged": (): heap.Ref<boolean> => { 453 if (WEBEXT?.sessions?.onChanged && "removeListener" in WEBEXT?.sessions?.onChanged) { 454 return A.H.TRUE; 455 } 456 return A.H.FALSE; 457 }, 458 "func_OffChanged": (fn: Pointer): void => { 459 A.store.Ref(fn, WEBEXT.sessions.onChanged.removeListener); 460 }, 461 "call_OffChanged": (retPtr: Pointer, callback: heap.Ref<object>): void => { 462 const _ret = WEBEXT.sessions.onChanged.removeListener(A.H.get<object>(callback)); 463 }, 464 "try_OffChanged": (retPtr: Pointer, errPtr: Pointer, callback: heap.Ref<object>): heap.Ref<boolean> => { 465 try { 466 const _ret = WEBEXT.sessions.onChanged.removeListener(A.H.get<object>(callback)); 467 return A.H.TRUE; 468 } catch (err: any) { 469 A.store.Ref(errPtr, err); 470 return A.H.FALSE; 471 } 472 }, 473 "has_HasOnChanged": (): heap.Ref<boolean> => { 474 if (WEBEXT?.sessions?.onChanged && "hasListener" in WEBEXT?.sessions?.onChanged) { 475 return A.H.TRUE; 476 } 477 return A.H.FALSE; 478 }, 479 "func_HasOnChanged": (fn: Pointer): void => { 480 A.store.Ref(fn, WEBEXT.sessions.onChanged.hasListener); 481 }, 482 "call_HasOnChanged": (retPtr: Pointer, callback: heap.Ref<object>): void => { 483 const _ret = WEBEXT.sessions.onChanged.hasListener(A.H.get<object>(callback)); 484 A.store.Bool(retPtr, _ret); 485 }, 486 "try_HasOnChanged": (retPtr: Pointer, errPtr: Pointer, callback: heap.Ref<object>): heap.Ref<boolean> => { 487 try { 488 const _ret = WEBEXT.sessions.onChanged.hasListener(A.H.get<object>(callback)); 489 A.store.Bool(retPtr, _ret); 490 return A.H.TRUE; 491 } catch (err: any) { 492 A.store.Ref(errPtr, err); 493 return A.H.FALSE; 494 } 495 }, 496 "has_Restore": (): heap.Ref<boolean> => { 497 if (WEBEXT?.sessions && "restore" in WEBEXT?.sessions) { 498 return A.H.TRUE; 499 } 500 return A.H.FALSE; 501 }, 502 "func_Restore": (fn: Pointer): void => { 503 A.store.Ref(fn, WEBEXT.sessions.restore); 504 }, 505 "call_Restore": (retPtr: Pointer, sessionId: heap.Ref<object>): void => { 506 const _ret = WEBEXT.sessions.restore(A.H.get<object>(sessionId)); 507 A.store.Ref(retPtr, _ret); 508 }, 509 "try_Restore": (retPtr: Pointer, errPtr: Pointer, sessionId: heap.Ref<object>): heap.Ref<boolean> => { 510 try { 511 const _ret = WEBEXT.sessions.restore(A.H.get<object>(sessionId)); 512 A.store.Ref(retPtr, _ret); 513 return A.H.TRUE; 514 } catch (err: any) { 515 A.store.Ref(errPtr, err); 516 return A.H.FALSE; 517 } 518 }, 519 }; 520 });