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


TypeScript Router.on方法代码示例

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


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

示例1: listener

 public listener(): (message: any) => any {
   const router = new Router();
   router.on("/snapshot/prepare", (m) => this.snapshot.prepare(m));
   router.on("/snapshot/show", (m) => this.snapshot.show(m));
   router.on("/snapshot/remove", () => this.snapshot.remove());
   return router.listener();
 }
开发者ID:otiai10,项目名称:kanColleWidget,代码行数:7,代码来源:Kcs2.ts

示例2: Router

import { Router } from "chomex";
import NotificationService from "../../../Services/Notification";

const resolver = (id: string) => {
  const [name, query] = id.split("?");
  return {name};
};

const router = new Router(resolver);

router.on("Mission", async (id) => {
  const ns = new NotificationService();
  await ns.clear(id);
});

router.on("Recovery", async (id) => {
  const ns = new NotificationService();
  await ns.clear(id);
});

router.on("Shipbuilding", async (id) => {
  const ns = new NotificationService();
  await ns.clear(id);
});

export default router.listener();
开发者ID:otiai10,项目名称:kanColleWidget,代码行数:26,代码来源:NotificationClick.ts

示例3: Router

} from "../Controllers/Message/DamageSnapshot";
import {
  DebugAvailables,
  DebugController,
} from "../Controllers/Message/Debug";
import {
  OpenDeckCapturePage,
  OpenOptionsPage,
  WindowDecoration,
  WindowOpen,
  WindowRecord,
  WindowToggleMute,
} from "../Controllers/Message/Window";

const router = new Router();
router.on("/window/open", WindowOpen);
router.on("/window/decoration", WindowDecoration);
router.on("/window/record", WindowRecord);
router.on("/window/toggle-mute", WindowToggleMute);

// 設定画面
router.on("/options/open", OpenOptionsPage);

// 編成キャプチャ
router.on("/deckcapture/open", OpenDeckCapturePage);

// スクショとか
router.on("/capture/screenshot", Screenshot);

// 大破進撃防止窓
router.on("/snapshot/capture", DamageSnapshotCapture);
开发者ID:otiai10,项目名称:kanColleWidget,代码行数:31,代码来源:Message.ts

示例4: URLSearchParams

import { Router } from "chomex";
import { Screenshot } from "../Controllers/Alarms";

const resolver = (alarm) => {
  const [name, query] = alarm.name.split("?");
  alarm.params = new URLSearchParams(query);
  return {name};
};

const router = new Router(resolver);

router.on("/screenshot", Screenshot);

export default router.listener();
开发者ID:otiai10,项目名称:kanColleWidget,代码行数:14,代码来源:Alarms.ts


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