github.com/primecitizens/pcz/std@v0.2.1/plat/js/webext/mediaplayerprivate/bindings/ffi_bindings.ts (about) 1 import { importModule, Application, heap, Pointer } from "@ffi"; 2 3 importModule("plat/js/webext/mediaplayerprivate", (A: Application) => { 4 const WEBEXT = typeof globalThis.browser === "undefined" ? globalThis.chrome : globalThis.browser; 5 6 return { 7 "has_OnNextTrack": (): heap.Ref<boolean> => { 8 if (WEBEXT?.mediaPlayerPrivate?.onNextTrack && "addListener" in WEBEXT?.mediaPlayerPrivate?.onNextTrack) { 9 return A.H.TRUE; 10 } 11 return A.H.FALSE; 12 }, 13 "func_OnNextTrack": (fn: Pointer): void => { 14 A.store.Ref(fn, WEBEXT.mediaPlayerPrivate.onNextTrack.addListener); 15 }, 16 "call_OnNextTrack": (retPtr: Pointer, callback: heap.Ref<object>): void => { 17 const _ret = WEBEXT.mediaPlayerPrivate.onNextTrack.addListener(A.H.get<object>(callback)); 18 }, 19 "try_OnNextTrack": (retPtr: Pointer, errPtr: Pointer, callback: heap.Ref<object>): heap.Ref<boolean> => { 20 try { 21 const _ret = WEBEXT.mediaPlayerPrivate.onNextTrack.addListener(A.H.get<object>(callback)); 22 return A.H.TRUE; 23 } catch (err: any) { 24 A.store.Ref(errPtr, err); 25 return A.H.FALSE; 26 } 27 }, 28 "has_OffNextTrack": (): heap.Ref<boolean> => { 29 if (WEBEXT?.mediaPlayerPrivate?.onNextTrack && "removeListener" in WEBEXT?.mediaPlayerPrivate?.onNextTrack) { 30 return A.H.TRUE; 31 } 32 return A.H.FALSE; 33 }, 34 "func_OffNextTrack": (fn: Pointer): void => { 35 A.store.Ref(fn, WEBEXT.mediaPlayerPrivate.onNextTrack.removeListener); 36 }, 37 "call_OffNextTrack": (retPtr: Pointer, callback: heap.Ref<object>): void => { 38 const _ret = WEBEXT.mediaPlayerPrivate.onNextTrack.removeListener(A.H.get<object>(callback)); 39 }, 40 "try_OffNextTrack": (retPtr: Pointer, errPtr: Pointer, callback: heap.Ref<object>): heap.Ref<boolean> => { 41 try { 42 const _ret = WEBEXT.mediaPlayerPrivate.onNextTrack.removeListener(A.H.get<object>(callback)); 43 return A.H.TRUE; 44 } catch (err: any) { 45 A.store.Ref(errPtr, err); 46 return A.H.FALSE; 47 } 48 }, 49 "has_HasOnNextTrack": (): heap.Ref<boolean> => { 50 if (WEBEXT?.mediaPlayerPrivate?.onNextTrack && "hasListener" in WEBEXT?.mediaPlayerPrivate?.onNextTrack) { 51 return A.H.TRUE; 52 } 53 return A.H.FALSE; 54 }, 55 "func_HasOnNextTrack": (fn: Pointer): void => { 56 A.store.Ref(fn, WEBEXT.mediaPlayerPrivate.onNextTrack.hasListener); 57 }, 58 "call_HasOnNextTrack": (retPtr: Pointer, callback: heap.Ref<object>): void => { 59 const _ret = WEBEXT.mediaPlayerPrivate.onNextTrack.hasListener(A.H.get<object>(callback)); 60 A.store.Bool(retPtr, _ret); 61 }, 62 "try_HasOnNextTrack": (retPtr: Pointer, errPtr: Pointer, callback: heap.Ref<object>): heap.Ref<boolean> => { 63 try { 64 const _ret = WEBEXT.mediaPlayerPrivate.onNextTrack.hasListener(A.H.get<object>(callback)); 65 A.store.Bool(retPtr, _ret); 66 return A.H.TRUE; 67 } catch (err: any) { 68 A.store.Ref(errPtr, err); 69 return A.H.FALSE; 70 } 71 }, 72 "has_OnPrevTrack": (): heap.Ref<boolean> => { 73 if (WEBEXT?.mediaPlayerPrivate?.onPrevTrack && "addListener" in WEBEXT?.mediaPlayerPrivate?.onPrevTrack) { 74 return A.H.TRUE; 75 } 76 return A.H.FALSE; 77 }, 78 "func_OnPrevTrack": (fn: Pointer): void => { 79 A.store.Ref(fn, WEBEXT.mediaPlayerPrivate.onPrevTrack.addListener); 80 }, 81 "call_OnPrevTrack": (retPtr: Pointer, callback: heap.Ref<object>): void => { 82 const _ret = WEBEXT.mediaPlayerPrivate.onPrevTrack.addListener(A.H.get<object>(callback)); 83 }, 84 "try_OnPrevTrack": (retPtr: Pointer, errPtr: Pointer, callback: heap.Ref<object>): heap.Ref<boolean> => { 85 try { 86 const _ret = WEBEXT.mediaPlayerPrivate.onPrevTrack.addListener(A.H.get<object>(callback)); 87 return A.H.TRUE; 88 } catch (err: any) { 89 A.store.Ref(errPtr, err); 90 return A.H.FALSE; 91 } 92 }, 93 "has_OffPrevTrack": (): heap.Ref<boolean> => { 94 if (WEBEXT?.mediaPlayerPrivate?.onPrevTrack && "removeListener" in WEBEXT?.mediaPlayerPrivate?.onPrevTrack) { 95 return A.H.TRUE; 96 } 97 return A.H.FALSE; 98 }, 99 "func_OffPrevTrack": (fn: Pointer): void => { 100 A.store.Ref(fn, WEBEXT.mediaPlayerPrivate.onPrevTrack.removeListener); 101 }, 102 "call_OffPrevTrack": (retPtr: Pointer, callback: heap.Ref<object>): void => { 103 const _ret = WEBEXT.mediaPlayerPrivate.onPrevTrack.removeListener(A.H.get<object>(callback)); 104 }, 105 "try_OffPrevTrack": (retPtr: Pointer, errPtr: Pointer, callback: heap.Ref<object>): heap.Ref<boolean> => { 106 try { 107 const _ret = WEBEXT.mediaPlayerPrivate.onPrevTrack.removeListener(A.H.get<object>(callback)); 108 return A.H.TRUE; 109 } catch (err: any) { 110 A.store.Ref(errPtr, err); 111 return A.H.FALSE; 112 } 113 }, 114 "has_HasOnPrevTrack": (): heap.Ref<boolean> => { 115 if (WEBEXT?.mediaPlayerPrivate?.onPrevTrack && "hasListener" in WEBEXT?.mediaPlayerPrivate?.onPrevTrack) { 116 return A.H.TRUE; 117 } 118 return A.H.FALSE; 119 }, 120 "func_HasOnPrevTrack": (fn: Pointer): void => { 121 A.store.Ref(fn, WEBEXT.mediaPlayerPrivate.onPrevTrack.hasListener); 122 }, 123 "call_HasOnPrevTrack": (retPtr: Pointer, callback: heap.Ref<object>): void => { 124 const _ret = WEBEXT.mediaPlayerPrivate.onPrevTrack.hasListener(A.H.get<object>(callback)); 125 A.store.Bool(retPtr, _ret); 126 }, 127 "try_HasOnPrevTrack": (retPtr: Pointer, errPtr: Pointer, callback: heap.Ref<object>): heap.Ref<boolean> => { 128 try { 129 const _ret = WEBEXT.mediaPlayerPrivate.onPrevTrack.hasListener(A.H.get<object>(callback)); 130 A.store.Bool(retPtr, _ret); 131 return A.H.TRUE; 132 } catch (err: any) { 133 A.store.Ref(errPtr, err); 134 return A.H.FALSE; 135 } 136 }, 137 "has_OnTogglePlayState": (): heap.Ref<boolean> => { 138 if ( 139 WEBEXT?.mediaPlayerPrivate?.onTogglePlayState && 140 "addListener" in WEBEXT?.mediaPlayerPrivate?.onTogglePlayState 141 ) { 142 return A.H.TRUE; 143 } 144 return A.H.FALSE; 145 }, 146 "func_OnTogglePlayState": (fn: Pointer): void => { 147 A.store.Ref(fn, WEBEXT.mediaPlayerPrivate.onTogglePlayState.addListener); 148 }, 149 "call_OnTogglePlayState": (retPtr: Pointer, callback: heap.Ref<object>): void => { 150 const _ret = WEBEXT.mediaPlayerPrivate.onTogglePlayState.addListener(A.H.get<object>(callback)); 151 }, 152 "try_OnTogglePlayState": (retPtr: Pointer, errPtr: Pointer, callback: heap.Ref<object>): heap.Ref<boolean> => { 153 try { 154 const _ret = WEBEXT.mediaPlayerPrivate.onTogglePlayState.addListener(A.H.get<object>(callback)); 155 return A.H.TRUE; 156 } catch (err: any) { 157 A.store.Ref(errPtr, err); 158 return A.H.FALSE; 159 } 160 }, 161 "has_OffTogglePlayState": (): heap.Ref<boolean> => { 162 if ( 163 WEBEXT?.mediaPlayerPrivate?.onTogglePlayState && 164 "removeListener" in WEBEXT?.mediaPlayerPrivate?.onTogglePlayState 165 ) { 166 return A.H.TRUE; 167 } 168 return A.H.FALSE; 169 }, 170 "func_OffTogglePlayState": (fn: Pointer): void => { 171 A.store.Ref(fn, WEBEXT.mediaPlayerPrivate.onTogglePlayState.removeListener); 172 }, 173 "call_OffTogglePlayState": (retPtr: Pointer, callback: heap.Ref<object>): void => { 174 const _ret = WEBEXT.mediaPlayerPrivate.onTogglePlayState.removeListener(A.H.get<object>(callback)); 175 }, 176 "try_OffTogglePlayState": (retPtr: Pointer, errPtr: Pointer, callback: heap.Ref<object>): heap.Ref<boolean> => { 177 try { 178 const _ret = WEBEXT.mediaPlayerPrivate.onTogglePlayState.removeListener(A.H.get<object>(callback)); 179 return A.H.TRUE; 180 } catch (err: any) { 181 A.store.Ref(errPtr, err); 182 return A.H.FALSE; 183 } 184 }, 185 "has_HasOnTogglePlayState": (): heap.Ref<boolean> => { 186 if ( 187 WEBEXT?.mediaPlayerPrivate?.onTogglePlayState && 188 "hasListener" in WEBEXT?.mediaPlayerPrivate?.onTogglePlayState 189 ) { 190 return A.H.TRUE; 191 } 192 return A.H.FALSE; 193 }, 194 "func_HasOnTogglePlayState": (fn: Pointer): void => { 195 A.store.Ref(fn, WEBEXT.mediaPlayerPrivate.onTogglePlayState.hasListener); 196 }, 197 "call_HasOnTogglePlayState": (retPtr: Pointer, callback: heap.Ref<object>): void => { 198 const _ret = WEBEXT.mediaPlayerPrivate.onTogglePlayState.hasListener(A.H.get<object>(callback)); 199 A.store.Bool(retPtr, _ret); 200 }, 201 "try_HasOnTogglePlayState": (retPtr: Pointer, errPtr: Pointer, callback: heap.Ref<object>): heap.Ref<boolean> => { 202 try { 203 const _ret = WEBEXT.mediaPlayerPrivate.onTogglePlayState.hasListener(A.H.get<object>(callback)); 204 A.store.Bool(retPtr, _ret); 205 return A.H.TRUE; 206 } catch (err: any) { 207 A.store.Ref(errPtr, err); 208 return A.H.FALSE; 209 } 210 }, 211 }; 212 });