当前位置: 首页>>代码示例>>TypeScript>>正文


TypeScript Client.call方法代码示例

本文整理汇总了TypeScript中butlerd.Client.call方法的典型用法代码示例。如果您正苦于以下问题:TypeScript Client.call方法的具体用法?TypeScript Client.call怎么用?TypeScript Client.call使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在butlerd.Client的用法示例。


在下文中一共展示了Client.call方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。

示例1: async

  sanityCheck: async (ctx, logger, versionPrefix) => {
    const instance = await makeButlerInstance({ ctx, versionPrefix });
    // we're awaiting it later, avoid 'unhandledRejection'
    instance.promise().catch(() => {});

    const client = new Client(await instance.getEndpoint());
    await client.call(messages.VersionGet, {});
  },
开发者ID:itchio,项目名称:itch,代码行数:8,代码来源:formulas.ts

示例2: async

 sanityCheck: async (versionPrefix: string) => {
   const instance = await makeButlerInstanceWithPrefix(versionPrefix);
   // we're awaiting it later, avoid 'unhandledRejection'
   instance.promise().catch(() => {});
   try {
     const client = new Client(await instance.getEndpoint());
     await client.connect();
     await client.call(messages.VersionGet, {});
     client.close();
   } finally {
     await instance.promise();
   }
 },
开发者ID:HorrerGames,项目名称:itch,代码行数:13,代码来源:formulas.ts

示例3: async


//.........这里部分代码省略.........
              },
              buttons: [
                {
                  label: ["prompt.action.continue"],
                  action: actions.modalResponse({
                    continue: true,
                  }),
                },
                "cancel",
              ],
            })
          );

          if (res) {
            return { continue: true };
          }

          return { continue: false };
        });

        client.on(messages.PrereqsEnded, async () => {
          closePrereqsModal();
        });

        client.on(messages.LaunchWindowShouldBeForeground, async ({ hwnd }) => {
          try {
            require("asfw").SetForegroundWindow(hwnd);
          } catch (e) {
            logger.warn(`Could not set foreground window: ${e.stack}`);
          }
        });

        client.on(messages.LaunchRunning, async () => {
          logger.info("Now running!");
          ctx.emitProgress({ progress: 1, stage: "run" });

          if (preferences.preventDisplaySleep) {
            powerSaveBlockerId = powerSaveBlocker.start(
              "prevent-display-sleep"
            );
          }
        });

        client.on(messages.LaunchExited, async () => {
          logger.info("Exited!");
          ctx.emitProgress({ progress: -1, stage: "clean" });
        });

        client.on(messages.AllowSandboxSetup, async () => {
          let messageString: ILocalizedString = "";
          let detailString: ILocalizedString = "";

          if (process.platform === "win32") {
            messageString = ["sandbox.setup.windows.message"];
            detailString = ["sandbox.setup.windows.detail"];
          } else {
            messageString = ["sandbox.setup.linux.message"];
            detailString = ["sandbox.setup.linux.detail"];
          }

          const res = await promisedModal(
            store,
            modalWidgets.sandboxBlessing.make({
              window: "root",
              title: ["sandbox.setup.title"],
              message: messageString,
              detail: detailString,
              widgetParams: {},
              buttons: [
                {
                  label: ["sandbox.setup.proceed"],
                  action: modalWidgets.sandboxBlessing.action({
                    sandboxBlessing: true,
                  }),
                  icon: "security",
                },
                "cancel",
              ],
            })
          );
          if (res && res.sandboxBlessing) {
            return { allow: true };
          }

          return { allow: false };
        });

        await client.call(messages.Launch, {
          caveId: cave.id,
          prereqsDir,
          sandbox: preferences.isolateApps,
        });
      } finally {
        closePrereqsModal();
        client.close();
        if (powerSaveBlockerId) {
          powerSaveBlocker.stop(powerSaveBlockerId);
        }
      }
    },
开发者ID:HorrerGames,项目名称:itch,代码行数:101,代码来源:perform-launch.ts

示例4: cancel

 async cancel() {
   this.setPhase(Phase.CANCELLING);
   await this.client.call(messages.DownloadsDriveCancel, {});
   this.client = null;
 }
开发者ID:HorrerGames,项目名称:itch,代码行数:5,代码来源:driver-persistent-state.ts


注:本文中的butlerd.Client.call方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。