mirror of
https://github.com/wailsapp/wails.git
synced 2025-05-03 06:01:52 +08:00
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:
parent
f6d0d383f1
commit
5302ce57db
@ -6,6 +6,7 @@ import (
|
|||||||
"fmt"
|
"fmt"
|
||||||
"reflect"
|
"reflect"
|
||||||
"runtime"
|
"runtime"
|
||||||
|
"strings"
|
||||||
|
|
||||||
"github.com/wailsapp/wails/lib/logger"
|
"github.com/wailsapp/wails/lib/logger"
|
||||||
)
|
)
|
||||||
@ -27,6 +28,10 @@ func newBoundFunction(object interface{}) (*boundFunction, error) {
|
|||||||
objectType := reflect.TypeOf(object)
|
objectType := reflect.TypeOf(object)
|
||||||
|
|
||||||
name := runtime.FuncForPC(objectValue.Pointer()).Name()
|
name := runtime.FuncForPC(objectValue.Pointer()).Name()
|
||||||
|
if strings.Contains(name, "/") {
|
||||||
|
parts := strings.Split(name, "/")
|
||||||
|
name = parts[len(parts)-1]
|
||||||
|
}
|
||||||
|
|
||||||
result := &boundFunction{
|
result := &boundFunction{
|
||||||
fullName: name,
|
fullName: name,
|
||||||
|
Loading…
Reference in New Issue
Block a user