[runtime] Add cancelation of bound method calls and context passing

This commit is contained in:
stffabi
2024-03-04 10:34:14 +01:00
parent 7e687750b2
commit bfe9a9d015
25 changed files with 319 additions and 124 deletions
@@ -13,3 +13,13 @@ import {Call} from '@wailsio/runtime';
export async function Greet(name) {
return Call.ByID(1411160069, ...Array.prototype.slice.call(arguments, 0));
}
/**
* Greet someone
* @function GreetWithContext
* @param name {string}
* @returns {Promise<string>}
**/
export async function GreetWithContext(name) {
return Call.ByID(1310150960, ...Array.prototype.slice.call(arguments, 0));
}
@@ -13,3 +13,13 @@ import {Call} from '@wailsio/runtime';
export async function Greet(name) {
return Call.ByName("main.GreetService.Greet", ...Array.prototype.slice.call(arguments, 0));
}
/**
* Greet someone
* @function GreetWithContext
* @param name {string}
* @returns {Promise<string>}
**/
export async function GreetWithContext(name) {
return Call.ByName("main.GreetService.GreetWithContext", ...Array.prototype.slice.call(arguments, 0));
}
@@ -7,3 +7,8 @@ export async function Greet(name: string) : Promise<string> {
return Call.ByName("main.GreetService.Greet", name);
}
// Greet someone
export async function GreetWithContext(name: string) : Promise<string> {
return Call.ByName("main.GreetService.GreetWithContext", name);
}
@@ -7,3 +7,8 @@ export async function Greet(name: string) : Promise<string> {
return Call.ByID(1411160069, name);
}
// Greet someone
export async function GreetWithContext(name: string) : Promise<string> {
return Call.ByID(1310150960, name);
}
+8 -1
View File
@@ -1,9 +1,11 @@
package main
import (
"context"
_ "embed"
"github.com/wailsapp/wails/v3/pkg/application"
"log"
"github.com/wailsapp/wails/v3/pkg/application"
)
// GreetService is great
@@ -17,6 +19,11 @@ func (*GreetService) Greet(name string) string {
return "Hello " + name
}
// Greet someone
func (*GreetService) GreetWithContext(ctx context.Context, name string) string {
return "Hello " + name
}
func NewGreetService() *GreetService {
return &GreetService{}
}