[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
+12 -1
View File
@@ -3,7 +3,6 @@ package parser
import (
"errors"
"fmt"
"github.com/wailsapp/wails/v3/internal/flags"
"go/ast"
"go/build"
"go/parser"
@@ -16,6 +15,8 @@ import (
"strings"
"time"
"github.com/wailsapp/wails/v3/internal/flags"
"github.com/samber/lo"
"github.com/wailsapp/wails/v3/internal/hash"
)
@@ -138,6 +139,16 @@ type BoundMethod struct {
Alias *uint32
}
func (m BoundMethod) JSInputs() []*Parameter {
if len(m.Inputs) > 0 {
if firstArg := m.Inputs[0]; isContext(firstArg) {
return m.Inputs[1:]
}
}
return m.Inputs
}
func (m BoundMethod) IDAsString() string {
return strconv.Itoa(int(m.ID))
}