1
0

udpservice.js 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. // @ts-check
  2. // Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL
  3. // This file is automatically generated. DO NOT EDIT
  4. /**
  5. * UDPService 是 UDP 键值服务的 Wails 服务。
  6. * @module
  7. */
  8. // eslint-disable-next-line @typescript-eslint/ban-ts-comment
  9. // @ts-ignore: Unused imports
  10. import { Call as $Call, CancellablePromise as $CancellablePromise, Create as $Create } from "@wailsio/runtime";
  11. // eslint-disable-next-line @typescript-eslint/ban-ts-comment
  12. // @ts-ignore: Unused imports
  13. import * as $models from "./models.js";
  14. /**
  15. * SendUDP 手动发送文本到指定远端(addr 形如 ip:port)。
  16. * @param {string} addr
  17. * @param {string} text
  18. * @returns {$CancellablePromise<$models.UDPInfo>}
  19. */
  20. export function SendUDP(addr, text) {
  21. return $Call.ByID(1977683411, addr, text).then(/** @type {($result: any) => any} */(($result) => {
  22. return $$createType0($result);
  23. }));
  24. }
  25. /**
  26. * StartUDPServer 启动 UDP 键值服务器,监听 0.0.0.0:port。
  27. * 若已运行则先停止旧实例,并清空键值存储。端口占用时返回错误。
  28. * @param {number} port
  29. * @returns {$CancellablePromise<$models.UDPInfo>}
  30. */
  31. export function StartUDPServer(port) {
  32. return $Call.ByID(1291615814, port).then(/** @type {($result: any) => any} */(($result) => {
  33. return $$createType0($result);
  34. }));
  35. }
  36. /**
  37. * StopUDPServer 停止当前 UDP 键值服务(未运行则无副作用),并清空键值存储。
  38. * @returns {$CancellablePromise<$models.UDPInfo>}
  39. */
  40. export function StopUDPServer() {
  41. return $Call.ByID(2179332070).then(/** @type {($result: any) => any} */(($result) => {
  42. return $$createType0($result);
  43. }));
  44. }
  45. /**
  46. * UDPServerJSON 为前端提供一次调用获取完整状态的辅助(避免多次 IPC)。
  47. * @returns {$CancellablePromise<string>}
  48. */
  49. export function UDPServerJSON() {
  50. return $Call.ByID(839381736);
  51. }
  52. /**
  53. * UDPServerStatus 返回当前 UDP 键值服务状态。
  54. * @returns {$CancellablePromise<$models.UDPInfo>}
  55. */
  56. export function UDPServerStatus() {
  57. return $Call.ByID(830505824).then(/** @type {($result: any) => any} */(($result) => {
  58. return $$createType0($result);
  59. }));
  60. }
  61. // Private type creation functions
  62. const $$createType0 = $models.UDPInfo.createFrom;