greetservice.js 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637
  1. // @ts-check
  2. // Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL
  3. // This file is automatically generated. DO NOT EDIT
  4. /**
  5. * GreetService 是一个暴露给前端调用的示例服务。
  6. * 在 main.go 中通过 application.NewService(&GreetService{}) 注册后,
  7. * Wails 会自动为其生成 JS/TS 绑定(frontend/bindings 目录),
  8. * 前端即可像调用本地函数一样直接调用 Greet 方法(底层通过 IPC 桥接)。
  9. * @module
  10. */
  11. // eslint-disable-next-line @typescript-eslint/ban-ts-comment
  12. // @ts-ignore: Unused imports
  13. import { Call as $Call, CancellablePromise as $CancellablePromise, Create as $Create } from "@wailsio/runtime";
  14. /**
  15. * Greet 返回对 name 的问候语。
  16. *
  17. * 调用链:前端 main.js 的 doGreet() → GreetService.Greet(name) → 本方法。
  18. * 前端调用示例:GreetService.Greet("张三") → 返回 "您好 张三!"
  19. * 参数与返回值由 Wails 自动完成 Go 与 JS 之间的序列化/反序列化。
  20. * @param {string} name
  21. * @returns {$CancellablePromise<string>}
  22. */
  23. export function Greet(name) {
  24. return $Call.ByID(1411160069, name);
  25. }
  26. /**
  27. * GreetMany 返回对一批 name 的问候语(示例方法,演示切片参数的绑定与序列化)。
  28. * @param {string[]} names
  29. * @returns {$CancellablePromise<string>}
  30. */
  31. export function GreetMany(names) {
  32. return $Call.ByID(1896900098, names);
  33. }