wails icon indicating copy to clipboard operation
wails copied to clipboard

Proposal: introduce a standard api interface to make interceptors possible

Open dennypenta opened this issue 9 months ago • 0 comments

Is your feature request related to a problem? Please describe.

Recently wails introduced an error formatting function which is very useful and can remove a bunch of boilerplate.

In my experience I miss such a function to handle not only an error, the the request/response data as well.

Describe the solution you'd like

Let’s say we have a bind method: type Method func(req interface{}) (res interface, err error)

And an interceptor function: type Interceptor func(f Method, name string, req interface{})

In case of satisfying a Method function definition the Interceptor type allows to handle pre/post calls.

Describe alternatives you've considered

The current solution doesn’t allow to wrap the methods manually since there is no such option to assign a method to a struct

Additional context

No response

dennypenta avatar Sep 10 '23 09:09 dennypenta