github.com/primecitizens/pcz/std@v0.2.1/plat/js/webext/management/bindings/ffi_bindings.ts (about)

     1  import { importModule, Application, heap, Pointer } from "@ffi";
     2  
     3  importModule("plat/js/webext/management", (A: Application) => {
     4    const WEBEXT = typeof globalThis.browser === "undefined" ? globalThis.chrome : globalThis.browser;
     5  
     6    return {
     7      "constof_ExtensionDisabledReason": (ref: heap.Ref<string>): number => {
     8        const idx = ["unknown", "permissions_increase"].indexOf(A.H.get(ref));
     9        return idx < 0 ? 0 : idx + 1;
    10      },
    11      "constof_LaunchType": (ref: heap.Ref<string>): number => {
    12        const idx = ["OPEN_AS_REGULAR_TAB", "OPEN_AS_PINNED_TAB", "OPEN_AS_WINDOW", "OPEN_FULL_SCREEN"].indexOf(
    13          A.H.get(ref)
    14        );
    15        return idx < 0 ? 0 : idx + 1;
    16      },
    17  
    18      "store_IconInfo": (ptr: Pointer, ref: heap.Ref<any>) => {
    19        const x = A.H.get<any>(ref);
    20  
    21        if (typeof x === "undefined") {
    22          A.store.Bool(ptr + 12, false);
    23          A.store.Int64(ptr + 0, 0);
    24          A.store.Ref(ptr + 8, undefined);
    25        } else {
    26          A.store.Bool(ptr + 12, true);
    27          A.store.Int64(ptr + 0, x["size"] === undefined ? 0 : (x["size"] as number));
    28          A.store.Ref(ptr + 8, x["url"]);
    29        }
    30      },
    31      "load_IconInfo": (ptr: Pointer, create: heap.Ref<boolean>, ref: heap.Ref<any>): heap.Ref<any> => {
    32        const x = create === A.H.TRUE ? {} : A.H.get<any>(ref);
    33  
    34        x["size"] = A.load.Int64(ptr + 0);
    35        x["url"] = A.load.Ref(ptr + 8, undefined);
    36        return create === A.H.TRUE ? A.H.push(x) : ref;
    37      },
    38      "constof_ExtensionInstallType": (ref: heap.Ref<string>): number => {
    39        const idx = ["admin", "development", "normal", "sideload", "other"].indexOf(A.H.get(ref));
    40        return idx < 0 ? 0 : idx + 1;
    41      },
    42      "constof_ExtensionType": (ref: heap.Ref<string>): number => {
    43        const idx = [
    44          "extension",
    45          "hosted_app",
    46          "packaged_app",
    47          "legacy_packaged_app",
    48          "theme",
    49          "login_screen_extension",
    50        ].indexOf(A.H.get(ref));
    51        return idx < 0 ? 0 : idx + 1;
    52      },
    53  
    54      "store_ExtensionInfo": (ptr: Pointer, ref: heap.Ref<any>) => {
    55        const x = A.H.get<any>(ref);
    56  
    57        if (typeof x === "undefined") {
    58          A.store.Bool(ptr + 89, false);
    59          A.store.Ref(ptr + 0, undefined);
    60          A.store.Ref(ptr + 4, undefined);
    61          A.store.Ref(ptr + 8, undefined);
    62          A.store.Enum(ptr + 12, -1);
    63          A.store.Bool(ptr + 16, false);
    64          A.store.Ref(ptr + 20, undefined);
    65          A.store.Ref(ptr + 24, undefined);
    66          A.store.Ref(ptr + 28, undefined);
    67          A.store.Ref(ptr + 32, undefined);
    68          A.store.Enum(ptr + 36, -1);
    69          A.store.Bool(ptr + 40, false);
    70          A.store.Enum(ptr + 44, -1);
    71          A.store.Bool(ptr + 48, false);
    72          A.store.Bool(ptr + 88, false);
    73          A.store.Bool(ptr + 49, false);
    74          A.store.Ref(ptr + 52, undefined);
    75          A.store.Bool(ptr + 56, false);
    76          A.store.Ref(ptr + 60, undefined);
    77          A.store.Ref(ptr + 64, undefined);
    78          A.store.Ref(ptr + 68, undefined);
    79          A.store.Enum(ptr + 72, -1);
    80          A.store.Ref(ptr + 76, undefined);
    81          A.store.Ref(ptr + 80, undefined);
    82          A.store.Ref(ptr + 84, undefined);
    83        } else {
    84          A.store.Bool(ptr + 89, true);
    85          A.store.Ref(ptr + 0, x["appLaunchUrl"]);
    86          A.store.Ref(ptr + 4, x["availableLaunchTypes"]);
    87          A.store.Ref(ptr + 8, x["description"]);
    88          A.store.Enum(ptr + 12, ["unknown", "permissions_increase"].indexOf(x["disabledReason"] as string));
    89          A.store.Bool(ptr + 16, x["enabled"] ? true : false);
    90          A.store.Ref(ptr + 20, x["homepageUrl"]);
    91          A.store.Ref(ptr + 24, x["hostPermissions"]);
    92          A.store.Ref(ptr + 28, x["icons"]);
    93          A.store.Ref(ptr + 32, x["id"]);
    94          A.store.Enum(
    95            ptr + 36,
    96            ["admin", "development", "normal", "sideload", "other"].indexOf(x["installType"] as string)
    97          );
    98          A.store.Bool(ptr + 40, x["isApp"] ? true : false);
    99          A.store.Enum(
   100            ptr + 44,
   101            ["OPEN_AS_REGULAR_TAB", "OPEN_AS_PINNED_TAB", "OPEN_AS_WINDOW", "OPEN_FULL_SCREEN"].indexOf(
   102              x["launchType"] as string
   103            )
   104          );
   105          A.store.Bool(ptr + 48, x["mayDisable"] ? true : false);
   106          A.store.Bool(ptr + 88, "mayEnable" in x ? true : false);
   107          A.store.Bool(ptr + 49, x["mayEnable"] ? true : false);
   108          A.store.Ref(ptr + 52, x["name"]);
   109          A.store.Bool(ptr + 56, x["offlineEnabled"] ? true : false);
   110          A.store.Ref(ptr + 60, x["optionsUrl"]);
   111          A.store.Ref(ptr + 64, x["permissions"]);
   112          A.store.Ref(ptr + 68, x["shortName"]);
   113          A.store.Enum(
   114            ptr + 72,
   115            ["extension", "hosted_app", "packaged_app", "legacy_packaged_app", "theme", "login_screen_extension"].indexOf(
   116              x["type"] as string
   117            )
   118          );
   119          A.store.Ref(ptr + 76, x["updateUrl"]);
   120          A.store.Ref(ptr + 80, x["version"]);
   121          A.store.Ref(ptr + 84, x["versionName"]);
   122        }
   123      },
   124      "load_ExtensionInfo": (ptr: Pointer, create: heap.Ref<boolean>, ref: heap.Ref<any>): heap.Ref<any> => {
   125        const x = create === A.H.TRUE ? {} : A.H.get<any>(ref);
   126  
   127        x["appLaunchUrl"] = A.load.Ref(ptr + 0, undefined);
   128        x["availableLaunchTypes"] = A.load.Ref(ptr + 4, undefined);
   129        x["description"] = A.load.Ref(ptr + 8, undefined);
   130        x["disabledReason"] = A.load.Enum(ptr + 12, ["unknown", "permissions_increase"]);
   131        x["enabled"] = A.load.Bool(ptr + 16);
   132        x["homepageUrl"] = A.load.Ref(ptr + 20, undefined);
   133        x["hostPermissions"] = A.load.Ref(ptr + 24, undefined);
   134        x["icons"] = A.load.Ref(ptr + 28, undefined);
   135        x["id"] = A.load.Ref(ptr + 32, undefined);
   136        x["installType"] = A.load.Enum(ptr + 36, ["admin", "development", "normal", "sideload", "other"]);
   137        x["isApp"] = A.load.Bool(ptr + 40);
   138        x["launchType"] = A.load.Enum(ptr + 44, [
   139          "OPEN_AS_REGULAR_TAB",
   140          "OPEN_AS_PINNED_TAB",
   141          "OPEN_AS_WINDOW",
   142          "OPEN_FULL_SCREEN",
   143        ]);
   144        x["mayDisable"] = A.load.Bool(ptr + 48);
   145        if (A.load.Bool(ptr + 88)) {
   146          x["mayEnable"] = A.load.Bool(ptr + 49);
   147        } else {
   148          delete x["mayEnable"];
   149        }
   150        x["name"] = A.load.Ref(ptr + 52, undefined);
   151        x["offlineEnabled"] = A.load.Bool(ptr + 56);
   152        x["optionsUrl"] = A.load.Ref(ptr + 60, undefined);
   153        x["permissions"] = A.load.Ref(ptr + 64, undefined);
   154        x["shortName"] = A.load.Ref(ptr + 68, undefined);
   155        x["type"] = A.load.Enum(ptr + 72, [
   156          "extension",
   157          "hosted_app",
   158          "packaged_app",
   159          "legacy_packaged_app",
   160          "theme",
   161          "login_screen_extension",
   162        ]);
   163        x["updateUrl"] = A.load.Ref(ptr + 76, undefined);
   164        x["version"] = A.load.Ref(ptr + 80, undefined);
   165        x["versionName"] = A.load.Ref(ptr + 84, undefined);
   166        return create === A.H.TRUE ? A.H.push(x) : ref;
   167      },
   168  
   169      "store_UninstallOptions": (ptr: Pointer, ref: heap.Ref<any>) => {
   170        const x = A.H.get<any>(ref);
   171  
   172        if (typeof x === "undefined") {
   173          A.store.Bool(ptr + 2, false);
   174          A.store.Bool(ptr + 1, false);
   175          A.store.Bool(ptr + 0, false);
   176        } else {
   177          A.store.Bool(ptr + 2, true);
   178          A.store.Bool(ptr + 1, "showConfirmDialog" in x ? true : false);
   179          A.store.Bool(ptr + 0, x["showConfirmDialog"] ? true : false);
   180        }
   181      },
   182      "load_UninstallOptions": (ptr: Pointer, create: heap.Ref<boolean>, ref: heap.Ref<any>): heap.Ref<any> => {
   183        const x = create === A.H.TRUE ? {} : A.H.get<any>(ref);
   184  
   185        if (A.load.Bool(ptr + 1)) {
   186          x["showConfirmDialog"] = A.load.Bool(ptr + 0);
   187        } else {
   188          delete x["showConfirmDialog"];
   189        }
   190        return create === A.H.TRUE ? A.H.push(x) : ref;
   191      },
   192      "has_CreateAppShortcut": (): heap.Ref<boolean> => {
   193        if (WEBEXT?.management && "createAppShortcut" in WEBEXT?.management) {
   194          return A.H.TRUE;
   195        }
   196        return A.H.FALSE;
   197      },
   198      "func_CreateAppShortcut": (fn: Pointer): void => {
   199        A.store.Ref(fn, WEBEXT.management.createAppShortcut);
   200      },
   201      "call_CreateAppShortcut": (retPtr: Pointer, id: heap.Ref<object>): void => {
   202        const _ret = WEBEXT.management.createAppShortcut(A.H.get<object>(id));
   203        A.store.Ref(retPtr, _ret);
   204      },
   205      "try_CreateAppShortcut": (retPtr: Pointer, errPtr: Pointer, id: heap.Ref<object>): heap.Ref<boolean> => {
   206        try {
   207          const _ret = WEBEXT.management.createAppShortcut(A.H.get<object>(id));
   208          A.store.Ref(retPtr, _ret);
   209          return A.H.TRUE;
   210        } catch (err: any) {
   211          A.store.Ref(errPtr, err);
   212          return A.H.FALSE;
   213        }
   214      },
   215      "has_GenerateAppForLink": (): heap.Ref<boolean> => {
   216        if (WEBEXT?.management && "generateAppForLink" in WEBEXT?.management) {
   217          return A.H.TRUE;
   218        }
   219        return A.H.FALSE;
   220      },
   221      "func_GenerateAppForLink": (fn: Pointer): void => {
   222        A.store.Ref(fn, WEBEXT.management.generateAppForLink);
   223      },
   224      "call_GenerateAppForLink": (retPtr: Pointer, url: heap.Ref<object>, title: heap.Ref<object>): void => {
   225        const _ret = WEBEXT.management.generateAppForLink(A.H.get<object>(url), A.H.get<object>(title));
   226        A.store.Ref(retPtr, _ret);
   227      },
   228      "try_GenerateAppForLink": (
   229        retPtr: Pointer,
   230        errPtr: Pointer,
   231        url: heap.Ref<object>,
   232        title: heap.Ref<object>
   233      ): heap.Ref<boolean> => {
   234        try {
   235          const _ret = WEBEXT.management.generateAppForLink(A.H.get<object>(url), A.H.get<object>(title));
   236          A.store.Ref(retPtr, _ret);
   237          return A.H.TRUE;
   238        } catch (err: any) {
   239          A.store.Ref(errPtr, err);
   240          return A.H.FALSE;
   241        }
   242      },
   243      "has_Get": (): heap.Ref<boolean> => {
   244        if (WEBEXT?.management && "get" in WEBEXT?.management) {
   245          return A.H.TRUE;
   246        }
   247        return A.H.FALSE;
   248      },
   249      "func_Get": (fn: Pointer): void => {
   250        A.store.Ref(fn, WEBEXT.management.get);
   251      },
   252      "call_Get": (retPtr: Pointer, id: heap.Ref<object>): void => {
   253        const _ret = WEBEXT.management.get(A.H.get<object>(id));
   254        A.store.Ref(retPtr, _ret);
   255      },
   256      "try_Get": (retPtr: Pointer, errPtr: Pointer, id: heap.Ref<object>): heap.Ref<boolean> => {
   257        try {
   258          const _ret = WEBEXT.management.get(A.H.get<object>(id));
   259          A.store.Ref(retPtr, _ret);
   260          return A.H.TRUE;
   261        } catch (err: any) {
   262          A.store.Ref(errPtr, err);
   263          return A.H.FALSE;
   264        }
   265      },
   266      "has_GetAll": (): heap.Ref<boolean> => {
   267        if (WEBEXT?.management && "getAll" in WEBEXT?.management) {
   268          return A.H.TRUE;
   269        }
   270        return A.H.FALSE;
   271      },
   272      "func_GetAll": (fn: Pointer): void => {
   273        A.store.Ref(fn, WEBEXT.management.getAll);
   274      },
   275      "call_GetAll": (retPtr: Pointer): void => {
   276        const _ret = WEBEXT.management.getAll();
   277        A.store.Ref(retPtr, _ret);
   278      },
   279      "try_GetAll": (retPtr: Pointer, errPtr: Pointer): heap.Ref<boolean> => {
   280        try {
   281          const _ret = WEBEXT.management.getAll();
   282          A.store.Ref(retPtr, _ret);
   283          return A.H.TRUE;
   284        } catch (err: any) {
   285          A.store.Ref(errPtr, err);
   286          return A.H.FALSE;
   287        }
   288      },
   289      "has_GetPermissionWarningsById": (): heap.Ref<boolean> => {
   290        if (WEBEXT?.management && "getPermissionWarningsById" in WEBEXT?.management) {
   291          return A.H.TRUE;
   292        }
   293        return A.H.FALSE;
   294      },
   295      "func_GetPermissionWarningsById": (fn: Pointer): void => {
   296        A.store.Ref(fn, WEBEXT.management.getPermissionWarningsById);
   297      },
   298      "call_GetPermissionWarningsById": (retPtr: Pointer, id: heap.Ref<object>): void => {
   299        const _ret = WEBEXT.management.getPermissionWarningsById(A.H.get<object>(id));
   300        A.store.Ref(retPtr, _ret);
   301      },
   302      "try_GetPermissionWarningsById": (retPtr: Pointer, errPtr: Pointer, id: heap.Ref<object>): heap.Ref<boolean> => {
   303        try {
   304          const _ret = WEBEXT.management.getPermissionWarningsById(A.H.get<object>(id));
   305          A.store.Ref(retPtr, _ret);
   306          return A.H.TRUE;
   307        } catch (err: any) {
   308          A.store.Ref(errPtr, err);
   309          return A.H.FALSE;
   310        }
   311      },
   312      "has_GetPermissionWarningsByManifest": (): heap.Ref<boolean> => {
   313        if (WEBEXT?.management && "getPermissionWarningsByManifest" in WEBEXT?.management) {
   314          return A.H.TRUE;
   315        }
   316        return A.H.FALSE;
   317      },
   318      "func_GetPermissionWarningsByManifest": (fn: Pointer): void => {
   319        A.store.Ref(fn, WEBEXT.management.getPermissionWarningsByManifest);
   320      },
   321      "call_GetPermissionWarningsByManifest": (retPtr: Pointer, manifestStr: heap.Ref<object>): void => {
   322        const _ret = WEBEXT.management.getPermissionWarningsByManifest(A.H.get<object>(manifestStr));
   323        A.store.Ref(retPtr, _ret);
   324      },
   325      "try_GetPermissionWarningsByManifest": (
   326        retPtr: Pointer,
   327        errPtr: Pointer,
   328        manifestStr: heap.Ref<object>
   329      ): heap.Ref<boolean> => {
   330        try {
   331          const _ret = WEBEXT.management.getPermissionWarningsByManifest(A.H.get<object>(manifestStr));
   332          A.store.Ref(retPtr, _ret);
   333          return A.H.TRUE;
   334        } catch (err: any) {
   335          A.store.Ref(errPtr, err);
   336          return A.H.FALSE;
   337        }
   338      },
   339      "has_GetSelf": (): heap.Ref<boolean> => {
   340        if (WEBEXT?.management && "getSelf" in WEBEXT?.management) {
   341          return A.H.TRUE;
   342        }
   343        return A.H.FALSE;
   344      },
   345      "func_GetSelf": (fn: Pointer): void => {
   346        A.store.Ref(fn, WEBEXT.management.getSelf);
   347      },
   348      "call_GetSelf": (retPtr: Pointer): void => {
   349        const _ret = WEBEXT.management.getSelf();
   350        A.store.Ref(retPtr, _ret);
   351      },
   352      "try_GetSelf": (retPtr: Pointer, errPtr: Pointer): heap.Ref<boolean> => {
   353        try {
   354          const _ret = WEBEXT.management.getSelf();
   355          A.store.Ref(retPtr, _ret);
   356          return A.H.TRUE;
   357        } catch (err: any) {
   358          A.store.Ref(errPtr, err);
   359          return A.H.FALSE;
   360        }
   361      },
   362      "has_InstallReplacementWebApp": (): heap.Ref<boolean> => {
   363        if (WEBEXT?.management && "installReplacementWebApp" in WEBEXT?.management) {
   364          return A.H.TRUE;
   365        }
   366        return A.H.FALSE;
   367      },
   368      "func_InstallReplacementWebApp": (fn: Pointer): void => {
   369        A.store.Ref(fn, WEBEXT.management.installReplacementWebApp);
   370      },
   371      "call_InstallReplacementWebApp": (retPtr: Pointer): void => {
   372        const _ret = WEBEXT.management.installReplacementWebApp();
   373        A.store.Ref(retPtr, _ret);
   374      },
   375      "try_InstallReplacementWebApp": (retPtr: Pointer, errPtr: Pointer): heap.Ref<boolean> => {
   376        try {
   377          const _ret = WEBEXT.management.installReplacementWebApp();
   378          A.store.Ref(retPtr, _ret);
   379          return A.H.TRUE;
   380        } catch (err: any) {
   381          A.store.Ref(errPtr, err);
   382          return A.H.FALSE;
   383        }
   384      },
   385      "has_LaunchApp": (): heap.Ref<boolean> => {
   386        if (WEBEXT?.management && "launchApp" in WEBEXT?.management) {
   387          return A.H.TRUE;
   388        }
   389        return A.H.FALSE;
   390      },
   391      "func_LaunchApp": (fn: Pointer): void => {
   392        A.store.Ref(fn, WEBEXT.management.launchApp);
   393      },
   394      "call_LaunchApp": (retPtr: Pointer, id: heap.Ref<object>): void => {
   395        const _ret = WEBEXT.management.launchApp(A.H.get<object>(id));
   396        A.store.Ref(retPtr, _ret);
   397      },
   398      "try_LaunchApp": (retPtr: Pointer, errPtr: Pointer, id: heap.Ref<object>): heap.Ref<boolean> => {
   399        try {
   400          const _ret = WEBEXT.management.launchApp(A.H.get<object>(id));
   401          A.store.Ref(retPtr, _ret);
   402          return A.H.TRUE;
   403        } catch (err: any) {
   404          A.store.Ref(errPtr, err);
   405          return A.H.FALSE;
   406        }
   407      },
   408      "has_OnDisabled": (): heap.Ref<boolean> => {
   409        if (WEBEXT?.management?.onDisabled && "addListener" in WEBEXT?.management?.onDisabled) {
   410          return A.H.TRUE;
   411        }
   412        return A.H.FALSE;
   413      },
   414      "func_OnDisabled": (fn: Pointer): void => {
   415        A.store.Ref(fn, WEBEXT.management.onDisabled.addListener);
   416      },
   417      "call_OnDisabled": (retPtr: Pointer, callback: heap.Ref<object>): void => {
   418        const _ret = WEBEXT.management.onDisabled.addListener(A.H.get<object>(callback));
   419      },
   420      "try_OnDisabled": (retPtr: Pointer, errPtr: Pointer, callback: heap.Ref<object>): heap.Ref<boolean> => {
   421        try {
   422          const _ret = WEBEXT.management.onDisabled.addListener(A.H.get<object>(callback));
   423          return A.H.TRUE;
   424        } catch (err: any) {
   425          A.store.Ref(errPtr, err);
   426          return A.H.FALSE;
   427        }
   428      },
   429      "has_OffDisabled": (): heap.Ref<boolean> => {
   430        if (WEBEXT?.management?.onDisabled && "removeListener" in WEBEXT?.management?.onDisabled) {
   431          return A.H.TRUE;
   432        }
   433        return A.H.FALSE;
   434      },
   435      "func_OffDisabled": (fn: Pointer): void => {
   436        A.store.Ref(fn, WEBEXT.management.onDisabled.removeListener);
   437      },
   438      "call_OffDisabled": (retPtr: Pointer, callback: heap.Ref<object>): void => {
   439        const _ret = WEBEXT.management.onDisabled.removeListener(A.H.get<object>(callback));
   440      },
   441      "try_OffDisabled": (retPtr: Pointer, errPtr: Pointer, callback: heap.Ref<object>): heap.Ref<boolean> => {
   442        try {
   443          const _ret = WEBEXT.management.onDisabled.removeListener(A.H.get<object>(callback));
   444          return A.H.TRUE;
   445        } catch (err: any) {
   446          A.store.Ref(errPtr, err);
   447          return A.H.FALSE;
   448        }
   449      },
   450      "has_HasOnDisabled": (): heap.Ref<boolean> => {
   451        if (WEBEXT?.management?.onDisabled && "hasListener" in WEBEXT?.management?.onDisabled) {
   452          return A.H.TRUE;
   453        }
   454        return A.H.FALSE;
   455      },
   456      "func_HasOnDisabled": (fn: Pointer): void => {
   457        A.store.Ref(fn, WEBEXT.management.onDisabled.hasListener);
   458      },
   459      "call_HasOnDisabled": (retPtr: Pointer, callback: heap.Ref<object>): void => {
   460        const _ret = WEBEXT.management.onDisabled.hasListener(A.H.get<object>(callback));
   461        A.store.Bool(retPtr, _ret);
   462      },
   463      "try_HasOnDisabled": (retPtr: Pointer, errPtr: Pointer, callback: heap.Ref<object>): heap.Ref<boolean> => {
   464        try {
   465          const _ret = WEBEXT.management.onDisabled.hasListener(A.H.get<object>(callback));
   466          A.store.Bool(retPtr, _ret);
   467          return A.H.TRUE;
   468        } catch (err: any) {
   469          A.store.Ref(errPtr, err);
   470          return A.H.FALSE;
   471        }
   472      },
   473      "has_OnEnabled": (): heap.Ref<boolean> => {
   474        if (WEBEXT?.management?.onEnabled && "addListener" in WEBEXT?.management?.onEnabled) {
   475          return A.H.TRUE;
   476        }
   477        return A.H.FALSE;
   478      },
   479      "func_OnEnabled": (fn: Pointer): void => {
   480        A.store.Ref(fn, WEBEXT.management.onEnabled.addListener);
   481      },
   482      "call_OnEnabled": (retPtr: Pointer, callback: heap.Ref<object>): void => {
   483        const _ret = WEBEXT.management.onEnabled.addListener(A.H.get<object>(callback));
   484      },
   485      "try_OnEnabled": (retPtr: Pointer, errPtr: Pointer, callback: heap.Ref<object>): heap.Ref<boolean> => {
   486        try {
   487          const _ret = WEBEXT.management.onEnabled.addListener(A.H.get<object>(callback));
   488          return A.H.TRUE;
   489        } catch (err: any) {
   490          A.store.Ref(errPtr, err);
   491          return A.H.FALSE;
   492        }
   493      },
   494      "has_OffEnabled": (): heap.Ref<boolean> => {
   495        if (WEBEXT?.management?.onEnabled && "removeListener" in WEBEXT?.management?.onEnabled) {
   496          return A.H.TRUE;
   497        }
   498        return A.H.FALSE;
   499      },
   500      "func_OffEnabled": (fn: Pointer): void => {
   501        A.store.Ref(fn, WEBEXT.management.onEnabled.removeListener);
   502      },
   503      "call_OffEnabled": (retPtr: Pointer, callback: heap.Ref<object>): void => {
   504        const _ret = WEBEXT.management.onEnabled.removeListener(A.H.get<object>(callback));
   505      },
   506      "try_OffEnabled": (retPtr: Pointer, errPtr: Pointer, callback: heap.Ref<object>): heap.Ref<boolean> => {
   507        try {
   508          const _ret = WEBEXT.management.onEnabled.removeListener(A.H.get<object>(callback));
   509          return A.H.TRUE;
   510        } catch (err: any) {
   511          A.store.Ref(errPtr, err);
   512          return A.H.FALSE;
   513        }
   514      },
   515      "has_HasOnEnabled": (): heap.Ref<boolean> => {
   516        if (WEBEXT?.management?.onEnabled && "hasListener" in WEBEXT?.management?.onEnabled) {
   517          return A.H.TRUE;
   518        }
   519        return A.H.FALSE;
   520      },
   521      "func_HasOnEnabled": (fn: Pointer): void => {
   522        A.store.Ref(fn, WEBEXT.management.onEnabled.hasListener);
   523      },
   524      "call_HasOnEnabled": (retPtr: Pointer, callback: heap.Ref<object>): void => {
   525        const _ret = WEBEXT.management.onEnabled.hasListener(A.H.get<object>(callback));
   526        A.store.Bool(retPtr, _ret);
   527      },
   528      "try_HasOnEnabled": (retPtr: Pointer, errPtr: Pointer, callback: heap.Ref<object>): heap.Ref<boolean> => {
   529        try {
   530          const _ret = WEBEXT.management.onEnabled.hasListener(A.H.get<object>(callback));
   531          A.store.Bool(retPtr, _ret);
   532          return A.H.TRUE;
   533        } catch (err: any) {
   534          A.store.Ref(errPtr, err);
   535          return A.H.FALSE;
   536        }
   537      },
   538      "has_OnInstalled": (): heap.Ref<boolean> => {
   539        if (WEBEXT?.management?.onInstalled && "addListener" in WEBEXT?.management?.onInstalled) {
   540          return A.H.TRUE;
   541        }
   542        return A.H.FALSE;
   543      },
   544      "func_OnInstalled": (fn: Pointer): void => {
   545        A.store.Ref(fn, WEBEXT.management.onInstalled.addListener);
   546      },
   547      "call_OnInstalled": (retPtr: Pointer, callback: heap.Ref<object>): void => {
   548        const _ret = WEBEXT.management.onInstalled.addListener(A.H.get<object>(callback));
   549      },
   550      "try_OnInstalled": (retPtr: Pointer, errPtr: Pointer, callback: heap.Ref<object>): heap.Ref<boolean> => {
   551        try {
   552          const _ret = WEBEXT.management.onInstalled.addListener(A.H.get<object>(callback));
   553          return A.H.TRUE;
   554        } catch (err: any) {
   555          A.store.Ref(errPtr, err);
   556          return A.H.FALSE;
   557        }
   558      },
   559      "has_OffInstalled": (): heap.Ref<boolean> => {
   560        if (WEBEXT?.management?.onInstalled && "removeListener" in WEBEXT?.management?.onInstalled) {
   561          return A.H.TRUE;
   562        }
   563        return A.H.FALSE;
   564      },
   565      "func_OffInstalled": (fn: Pointer): void => {
   566        A.store.Ref(fn, WEBEXT.management.onInstalled.removeListener);
   567      },
   568      "call_OffInstalled": (retPtr: Pointer, callback: heap.Ref<object>): void => {
   569        const _ret = WEBEXT.management.onInstalled.removeListener(A.H.get<object>(callback));
   570      },
   571      "try_OffInstalled": (retPtr: Pointer, errPtr: Pointer, callback: heap.Ref<object>): heap.Ref<boolean> => {
   572        try {
   573          const _ret = WEBEXT.management.onInstalled.removeListener(A.H.get<object>(callback));
   574          return A.H.TRUE;
   575        } catch (err: any) {
   576          A.store.Ref(errPtr, err);
   577          return A.H.FALSE;
   578        }
   579      },
   580      "has_HasOnInstalled": (): heap.Ref<boolean> => {
   581        if (WEBEXT?.management?.onInstalled && "hasListener" in WEBEXT?.management?.onInstalled) {
   582          return A.H.TRUE;
   583        }
   584        return A.H.FALSE;
   585      },
   586      "func_HasOnInstalled": (fn: Pointer): void => {
   587        A.store.Ref(fn, WEBEXT.management.onInstalled.hasListener);
   588      },
   589      "call_HasOnInstalled": (retPtr: Pointer, callback: heap.Ref<object>): void => {
   590        const _ret = WEBEXT.management.onInstalled.hasListener(A.H.get<object>(callback));
   591        A.store.Bool(retPtr, _ret);
   592      },
   593      "try_HasOnInstalled": (retPtr: Pointer, errPtr: Pointer, callback: heap.Ref<object>): heap.Ref<boolean> => {
   594        try {
   595          const _ret = WEBEXT.management.onInstalled.hasListener(A.H.get<object>(callback));
   596          A.store.Bool(retPtr, _ret);
   597          return A.H.TRUE;
   598        } catch (err: any) {
   599          A.store.Ref(errPtr, err);
   600          return A.H.FALSE;
   601        }
   602      },
   603      "has_OnUninstalled": (): heap.Ref<boolean> => {
   604        if (WEBEXT?.management?.onUninstalled && "addListener" in WEBEXT?.management?.onUninstalled) {
   605          return A.H.TRUE;
   606        }
   607        return A.H.FALSE;
   608      },
   609      "func_OnUninstalled": (fn: Pointer): void => {
   610        A.store.Ref(fn, WEBEXT.management.onUninstalled.addListener);
   611      },
   612      "call_OnUninstalled": (retPtr: Pointer, callback: heap.Ref<object>): void => {
   613        const _ret = WEBEXT.management.onUninstalled.addListener(A.H.get<object>(callback));
   614      },
   615      "try_OnUninstalled": (retPtr: Pointer, errPtr: Pointer, callback: heap.Ref<object>): heap.Ref<boolean> => {
   616        try {
   617          const _ret = WEBEXT.management.onUninstalled.addListener(A.H.get<object>(callback));
   618          return A.H.TRUE;
   619        } catch (err: any) {
   620          A.store.Ref(errPtr, err);
   621          return A.H.FALSE;
   622        }
   623      },
   624      "has_OffUninstalled": (): heap.Ref<boolean> => {
   625        if (WEBEXT?.management?.onUninstalled && "removeListener" in WEBEXT?.management?.onUninstalled) {
   626          return A.H.TRUE;
   627        }
   628        return A.H.FALSE;
   629      },
   630      "func_OffUninstalled": (fn: Pointer): void => {
   631        A.store.Ref(fn, WEBEXT.management.onUninstalled.removeListener);
   632      },
   633      "call_OffUninstalled": (retPtr: Pointer, callback: heap.Ref<object>): void => {
   634        const _ret = WEBEXT.management.onUninstalled.removeListener(A.H.get<object>(callback));
   635      },
   636      "try_OffUninstalled": (retPtr: Pointer, errPtr: Pointer, callback: heap.Ref<object>): heap.Ref<boolean> => {
   637        try {
   638          const _ret = WEBEXT.management.onUninstalled.removeListener(A.H.get<object>(callback));
   639          return A.H.TRUE;
   640        } catch (err: any) {
   641          A.store.Ref(errPtr, err);
   642          return A.H.FALSE;
   643        }
   644      },
   645      "has_HasOnUninstalled": (): heap.Ref<boolean> => {
   646        if (WEBEXT?.management?.onUninstalled && "hasListener" in WEBEXT?.management?.onUninstalled) {
   647          return A.H.TRUE;
   648        }
   649        return A.H.FALSE;
   650      },
   651      "func_HasOnUninstalled": (fn: Pointer): void => {
   652        A.store.Ref(fn, WEBEXT.management.onUninstalled.hasListener);
   653      },
   654      "call_HasOnUninstalled": (retPtr: Pointer, callback: heap.Ref<object>): void => {
   655        const _ret = WEBEXT.management.onUninstalled.hasListener(A.H.get<object>(callback));
   656        A.store.Bool(retPtr, _ret);
   657      },
   658      "try_HasOnUninstalled": (retPtr: Pointer, errPtr: Pointer, callback: heap.Ref<object>): heap.Ref<boolean> => {
   659        try {
   660          const _ret = WEBEXT.management.onUninstalled.hasListener(A.H.get<object>(callback));
   661          A.store.Bool(retPtr, _ret);
   662          return A.H.TRUE;
   663        } catch (err: any) {
   664          A.store.Ref(errPtr, err);
   665          return A.H.FALSE;
   666        }
   667      },
   668      "has_SetEnabled": (): heap.Ref<boolean> => {
   669        if (WEBEXT?.management && "setEnabled" in WEBEXT?.management) {
   670          return A.H.TRUE;
   671        }
   672        return A.H.FALSE;
   673      },
   674      "func_SetEnabled": (fn: Pointer): void => {
   675        A.store.Ref(fn, WEBEXT.management.setEnabled);
   676      },
   677      "call_SetEnabled": (retPtr: Pointer, id: heap.Ref<object>, enabled: heap.Ref<boolean>): void => {
   678        const _ret = WEBEXT.management.setEnabled(A.H.get<object>(id), enabled === A.H.TRUE);
   679        A.store.Ref(retPtr, _ret);
   680      },
   681      "try_SetEnabled": (
   682        retPtr: Pointer,
   683        errPtr: Pointer,
   684        id: heap.Ref<object>,
   685        enabled: heap.Ref<boolean>
   686      ): heap.Ref<boolean> => {
   687        try {
   688          const _ret = WEBEXT.management.setEnabled(A.H.get<object>(id), enabled === A.H.TRUE);
   689          A.store.Ref(retPtr, _ret);
   690          return A.H.TRUE;
   691        } catch (err: any) {
   692          A.store.Ref(errPtr, err);
   693          return A.H.FALSE;
   694        }
   695      },
   696      "has_SetLaunchType": (): heap.Ref<boolean> => {
   697        if (WEBEXT?.management && "setLaunchType" in WEBEXT?.management) {
   698          return A.H.TRUE;
   699        }
   700        return A.H.FALSE;
   701      },
   702      "func_SetLaunchType": (fn: Pointer): void => {
   703        A.store.Ref(fn, WEBEXT.management.setLaunchType);
   704      },
   705      "call_SetLaunchType": (retPtr: Pointer, id: heap.Ref<object>, launchType: number): void => {
   706        const _ret = WEBEXT.management.setLaunchType(
   707          A.H.get<object>(id),
   708          launchType > 0 && launchType <= 4
   709            ? ["OPEN_AS_REGULAR_TAB", "OPEN_AS_PINNED_TAB", "OPEN_AS_WINDOW", "OPEN_FULL_SCREEN"][launchType - 1]
   710            : undefined
   711        );
   712        A.store.Ref(retPtr, _ret);
   713      },
   714      "try_SetLaunchType": (
   715        retPtr: Pointer,
   716        errPtr: Pointer,
   717        id: heap.Ref<object>,
   718        launchType: number
   719      ): heap.Ref<boolean> => {
   720        try {
   721          const _ret = WEBEXT.management.setLaunchType(
   722            A.H.get<object>(id),
   723            launchType > 0 && launchType <= 4
   724              ? ["OPEN_AS_REGULAR_TAB", "OPEN_AS_PINNED_TAB", "OPEN_AS_WINDOW", "OPEN_FULL_SCREEN"][launchType - 1]
   725              : undefined
   726          );
   727          A.store.Ref(retPtr, _ret);
   728          return A.H.TRUE;
   729        } catch (err: any) {
   730          A.store.Ref(errPtr, err);
   731          return A.H.FALSE;
   732        }
   733      },
   734      "has_Uninstall": (): heap.Ref<boolean> => {
   735        if (WEBEXT?.management && "uninstall" in WEBEXT?.management) {
   736          return A.H.TRUE;
   737        }
   738        return A.H.FALSE;
   739      },
   740      "func_Uninstall": (fn: Pointer): void => {
   741        A.store.Ref(fn, WEBEXT.management.uninstall);
   742      },
   743      "call_Uninstall": (retPtr: Pointer, id: heap.Ref<object>, options: Pointer): void => {
   744        const options_ffi = {};
   745  
   746        if (A.load.Bool(options + 1)) {
   747          options_ffi["showConfirmDialog"] = A.load.Bool(options + 0);
   748        }
   749  
   750        const _ret = WEBEXT.management.uninstall(A.H.get<object>(id), options_ffi);
   751        A.store.Ref(retPtr, _ret);
   752      },
   753      "try_Uninstall": (retPtr: Pointer, errPtr: Pointer, id: heap.Ref<object>, options: Pointer): heap.Ref<boolean> => {
   754        try {
   755          const options_ffi = {};
   756  
   757          if (A.load.Bool(options + 1)) {
   758            options_ffi["showConfirmDialog"] = A.load.Bool(options + 0);
   759          }
   760  
   761          const _ret = WEBEXT.management.uninstall(A.H.get<object>(id), options_ffi);
   762          A.store.Ref(retPtr, _ret);
   763          return A.H.TRUE;
   764        } catch (err: any) {
   765          A.store.Ref(errPtr, err);
   766          return A.H.FALSE;
   767        }
   768      },
   769      "has_UninstallSelf": (): heap.Ref<boolean> => {
   770        if (WEBEXT?.management && "uninstallSelf" in WEBEXT?.management) {
   771          return A.H.TRUE;
   772        }
   773        return A.H.FALSE;
   774      },
   775      "func_UninstallSelf": (fn: Pointer): void => {
   776        A.store.Ref(fn, WEBEXT.management.uninstallSelf);
   777      },
   778      "call_UninstallSelf": (retPtr: Pointer, options: Pointer): void => {
   779        const options_ffi = {};
   780  
   781        if (A.load.Bool(options + 1)) {
   782          options_ffi["showConfirmDialog"] = A.load.Bool(options + 0);
   783        }
   784  
   785        const _ret = WEBEXT.management.uninstallSelf(options_ffi);
   786        A.store.Ref(retPtr, _ret);
   787      },
   788      "try_UninstallSelf": (retPtr: Pointer, errPtr: Pointer, options: Pointer): heap.Ref<boolean> => {
   789        try {
   790          const options_ffi = {};
   791  
   792          if (A.load.Bool(options + 1)) {
   793            options_ffi["showConfirmDialog"] = A.load.Bool(options + 0);
   794          }
   795  
   796          const _ret = WEBEXT.management.uninstallSelf(options_ffi);
   797          A.store.Ref(retPtr, _ret);
   798          return A.H.TRUE;
   799        } catch (err: any) {
   800          A.store.Ref(errPtr, err);
   801          return A.H.FALSE;
   802        }
   803      },
   804    };
   805  });