Handle use cases where the function is not from main (#655)

* Handle use cases where the function is not from main
This commit is contained in:
Sithembiso Khumalo
2021-05-16 06:08:30 +02:00
committed by GitHub
parent f6d0d383f1
commit 5302ce57db

View File

@@ -6,6 +6,7 @@ import (
"fmt"
"reflect"
"runtime"
"strings"
"github.com/wailsapp/wails/lib/logger"
)
@@ -27,6 +28,10 @@ func newBoundFunction(object interface{}) (*boundFunction, error) {
objectType := reflect.TypeOf(object)
name := runtime.FuncForPC(objectValue.Pointer()).Name()
if strings.Contains(name, "/") {
parts := strings.Split(name, "/")
name = parts[len(parts)-1]
}
result := &boundFunction{
fullName: name,