本文整理汇总了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();
}
示例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();
示例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);
示例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();