Skip to content

Commit

Permalink
[v3, assetServer] Update docs
Browse files Browse the repository at this point in the history
  • Loading branch information
stffabi committed Feb 21, 2024
1 parent 1956f95 commit 12d12a3
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 31 deletions.
40 changes: 15 additions & 25 deletions mkdocs-website/docs/en/API/fullapi.md
Original file line number Diff line number Diff line change
Expand Up @@ -1205,31 +1205,21 @@ AssetOptions defines the configuration of the AssetServer.

```go
type AssetOptions struct {
// FS defines the static assets to be used. A GET request is first tried to be served from this FS. If the FS returns
// `os.ErrNotExist` for that file, the request handling will fallback to the Handler and tries to serve the GET
// request from it.
//
// If set to nil, all GET requests will be forwarded to Handler.
FS fs.FS

// Handler will be called for every GET request that can't be served from FS, due to `os.ErrNotExist`. Furthermore all
// non GET requests will always be served from this Handler.
//
// If not defined, the result is the following in cases where the Handler would have been called:
// GET request: `http.StatusNotFound`
// Other request: `http.StatusMethodNotAllowed`
Handler http.Handler

// Middleware is HTTP Middleware which allows to hook into the AssetServer request chain. It allows to skip the default
// request handler dynamically, e.g. implement specialized Routing etc.
// The Middleware is called to build a new `http.Handler` used by the AssetSever and it also receives the default
// handler used by the AssetServer as an argument.
//
// If not defined, the default AssetServer request chain is executed.
//
// Multiple Middlewares can be chained together with:
// ChainMiddleware(middleware ...Middleware) Middleware
Middleware Middleware
// Handler which serves all the content to the WebView.
Handler http.Handler

// Middleware is a HTTP Middleware which allows to hook into the AssetServer request chain. It allows to skip the default
// request handler dynamically, e.g. implement specialized Routing etc.
// The Middleware is called to build a new `http.Handler` used by the AssetSever and it also receives the default
// handler used by the AssetServer as an argument.
//
// This middleware injects itself before any of Wails internal middlewares.
//
// If not defined, the default AssetServer request chain is executed.
//
// Multiple Middlewares can be chained together with:
// ChainMiddleware(middleware ...Middleware) Middleware
Middleware Middleware

// External URL can be set to a development server URL so that all requests are forwarded to it. This is useful
// when using a development server like `vite` or `snowpack` which serves the assets on a different port.
Expand Down
2 changes: 1 addition & 1 deletion mkdocs-website/docs/en/development/changes.md
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ Example:
2: 4021313248,
},
Assets: application.AssetOptions{
FS: assets,
Handler: application.AssetFileServerFS(assets),
},
Mac: application.MacOptions{
ApplicationShouldTerminateAfterLastWindowClosed: true,
Expand Down
4 changes: 2 additions & 2 deletions mkdocs-website/docs/en/whats-new.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ func main() {
app := application.New(application.Options{
Name: "Multi Window Demo",
Assets: application.AssetOptions{
FS: assets,
Handler: application.AssetFileServerFS(assets),
},
})

Expand Down Expand Up @@ -243,7 +243,7 @@ func main() {
Name: "Events Demo",
Description: "A demo of the Events API",
Assets: application.AssetOptions{
FS: assets,
Handler: application.AssetFileServerFS(assets),
},
Mac: application.MacOptions{
ApplicationShouldTerminateAfterLastWindowClosed: true,
Expand Down
2 changes: 1 addition & 1 deletion mkdocs-website/docs/zh/development/changes.md
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ window.go.main = {
2: 4021313248,
},
Assets: application.AssetOptions{
FS: assets,
Handler: application.AssetFileServerFS(assets),
},
Mac: application.MacOptions{
ApplicationShouldTerminateAfterLastWindowClosed: true,
Expand Down
4 changes: 2 additions & 2 deletions mkdocs-website/docs/zh/whats-new.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ func main() {
app := application.New(application.Options{
Name: "多窗口演示",
Assets: application.AssetOptions{
FS: assets,
Handler: application.AssetFileServerFS(assets),
},
})

Expand Down Expand Up @@ -233,7 +233,7 @@ func main() {
Name: "Events Demo",
Description: "Events API演示",
Assets: application.AssetOptions{
FS: assets,
Handler: application.AssetFileServerFS(assets),
},
Mac: application.MacOptions{
ApplicationShouldTerminateAfterLastWindowClosed: true,
Expand Down

0 comments on commit 12d12a3

Please sign in to comment.