mirror of
https://github.com/wailsapp/wails.git
synced 2026-03-14 14:45:49 +01:00
Mac examples + readme updated
This commit is contained in:
parent
131a6da554
commit
8e0671306a
21 changed files with 224 additions and 94 deletions
|
|
@ -8,6 +8,7 @@ Each milestone will have a set of goals that we are aiming to achieve. These are
|
|||
### Alpha 1
|
||||
|
||||
#### Goals
|
||||
|
||||
Alpha 1 is the initial release. It is intended to get feedback on the new API and to get people experimenting with it.
|
||||
The main goal is to get most of the examples working on all platforms.
|
||||
|
||||
|
|
@ -19,21 +20,27 @@ The main goal is to get most of the examples working on all platforms.
|
|||
|
||||
| Example | Mac | Windows | Linux |
|
||||
|---------------|-----|---------|-------|
|
||||
| binding | | W | |
|
||||
| build | | W | |
|
||||
| clipboard | | W | |
|
||||
| context menus | | W | |
|
||||
| dialog | | W | |
|
||||
| events | | W | |
|
||||
| frameless | | W | |
|
||||
| keybindings | | W | |
|
||||
| menu | | W | |
|
||||
| plain | | W | |
|
||||
| screen | | W | |
|
||||
| systray | | W | |
|
||||
| window | | W | |
|
||||
| binding | W | W | |
|
||||
| build | W | W | |
|
||||
| clipboard | W | W | |
|
||||
| context menus | W | W | |
|
||||
| dialogs | P | W | |
|
||||
| drag-n-drop | W | N | |
|
||||
| events | W | W | |
|
||||
| frameless | W | W | |
|
||||
| keybindings | W | W | |
|
||||
| plain | W | W | |
|
||||
| screen | W | W | |
|
||||
| systray | W | W | |
|
||||
| window | P | W | |
|
||||
| wml | | W | |
|
||||
|
||||
- Mac Dialogs work, however the file dialogs issue a warning that needs to be fixed.
|
||||
|
||||
#### TODO:
|
||||
|
||||
- [ ] Fix `+[CATransaction synchronize] called within transaction` warnings on mac
|
||||
- [ ] When hiding window, application terminates
|
||||
|
||||
### Alpha 2
|
||||
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@ The examples in this directory may or may not compile / run at any given time.
|
|||
|
||||
cd v3/examples/<example>
|
||||
go mod tidy
|
||||
go run main.go
|
||||
go run .
|
||||
|
||||
## Compiling the examples
|
||||
|
||||
|
|
|
|||
28
v3/examples/binding/assets/bindings_main.js
Normal file
28
v3/examples/binding/assets/bindings_main.js
Normal file
|
|
@ -0,0 +1,28 @@
|
|||
// @ts-check
|
||||
// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL
|
||||
// This file is automatically generated. DO NOT EDIT
|
||||
|
||||
import {main} from './models';
|
||||
|
||||
window.go = window.go || {};
|
||||
window.go.main = {
|
||||
GreetService: {
|
||||
|
||||
/**
|
||||
* GreetService.Greet
|
||||
* Greet greets a person
|
||||
* @param name {string}
|
||||
* @returns {Promise<string>}
|
||||
**/
|
||||
Greet: function(name) { wails.CallByID(1411160069, ...Array.prototype.slice.call(arguments, 0)); },
|
||||
|
||||
/**
|
||||
* GreetService.GreetPerson
|
||||
* GreetPerson greets a person
|
||||
* @param person {main.Person}
|
||||
* @returns {Promise<string>}
|
||||
**/
|
||||
GreetPerson: function(person) { wails.CallByID(4021313248, ...Array.prototype.slice.call(arguments, 0)); },
|
||||
},
|
||||
};
|
||||
|
||||
File diff suppressed because one or more lines are too long
24
v3/examples/binding/assets/models.ts
Normal file
24
v3/examples/binding/assets/models.ts
Normal file
|
|
@ -0,0 +1,24 @@
|
|||
// @ts-check
|
||||
// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL
|
||||
// This file is automatically generated. DO NOT EDIT
|
||||
|
||||
export namespace main {
|
||||
|
||||
export class Person {
|
||||
name: string; // Warning: this is unexported in the Go struct.
|
||||
|
||||
static createFrom(source: any = {}) {
|
||||
return new Person(source);
|
||||
}
|
||||
|
||||
constructor(source: any = {}) {
|
||||
if ('string' === typeof source) {
|
||||
source = JSON.parse(source);
|
||||
}
|
||||
|
||||
this.name = source['name'];
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -8,7 +8,7 @@ import (
|
|||
"github.com/wailsapp/wails/v3/pkg/application"
|
||||
)
|
||||
|
||||
//go:embed assets
|
||||
//go:embed assets/*
|
||||
var assets embed.FS
|
||||
|
||||
func main() {
|
||||
|
|
@ -16,7 +16,9 @@ func main() {
|
|||
Bind: []any{
|
||||
&GreetService{},
|
||||
},
|
||||
Assets: application.AlphaAssets,
|
||||
Assets: application.AssetOptions{
|
||||
FS: assets,
|
||||
},
|
||||
Mac: application.MacOptions{
|
||||
ApplicationShouldTerminateAfterLastWindowClosed: true,
|
||||
},
|
||||
|
|
|
|||
|
|
@ -11,13 +11,13 @@ requirement.
|
|||
To build the example, run:
|
||||
|
||||
```bash
|
||||
wails task build
|
||||
wails3 task build
|
||||
```
|
||||
|
||||
# Status
|
||||
|
||||
| Platform | Status |
|
||||
|----------|---------|
|
||||
| Mac | |
|
||||
| Mac | Working |
|
||||
| Windows | Working |
|
||||
| Linux | |
|
||||
|
|
@ -6,6 +6,6 @@ This example demonstrates how to use the clipboard API.
|
|||
|
||||
| Platform | Status |
|
||||
|----------|---------|
|
||||
| Mac | |
|
||||
| Mac | Working |
|
||||
| Windows | Working |
|
||||
| Linux | |
|
||||
|
|
@ -24,10 +24,7 @@ This is really useful when using components to distinguish between different ele
|
|||
|
||||
| Platform | Status |
|
||||
|----------|---------|
|
||||
| Mac | |
|
||||
| Mac | Working |
|
||||
| Windows | Working |
|
||||
| Linux | |
|
||||
|
||||
# TODO
|
||||
|
||||
- [ ] Windows: Fix crash for custom context menu
|
||||
|
|
@ -26,8 +26,8 @@ wails3 task package
|
|||
|
||||
# Status
|
||||
|
||||
| Platform | Status |
|
||||
|----------|---------|
|
||||
| Mac | |
|
||||
| Windows | Working |
|
||||
| Linux | |
|
||||
| Platform | Status |
|
||||
|----------|----------------|
|
||||
| Mac | Mostly Working |
|
||||
| Windows | Working |
|
||||
| Linux | |
|
||||
|
|
|
|||
|
|
@ -1,3 +1,27 @@
|
|||
# Drag-n-Drop Example
|
||||
# Drag-n-drop Example
|
||||
|
||||
This example is not ready for testing yet.
|
||||
This example demonstrates how to handle files being dragged into the application.
|
||||
|
||||
## Running the example
|
||||
|
||||
To run the example, simply run the following command:
|
||||
|
||||
```bash
|
||||
go run main.go
|
||||
```
|
||||
|
||||
## Building the example
|
||||
|
||||
To build the example in debug mode, simply run the following command:
|
||||
|
||||
```bash
|
||||
wails3 task build
|
||||
```
|
||||
|
||||
# Status
|
||||
|
||||
| Platform | Status |
|
||||
|----------|-------------|
|
||||
| Mac | Working |
|
||||
| Windows | Not Working |
|
||||
| Linux | |
|
||||
|
|
|
|||
|
|
@ -7,13 +7,13 @@ This example is a demonstration of using frameless windows in Wails.
|
|||
To run the example, simply run the following command:
|
||||
|
||||
```bash
|
||||
go run main.go
|
||||
go run .
|
||||
```
|
||||
|
||||
# Status
|
||||
|
||||
| Platform | Status |
|
||||
|----------|---------|
|
||||
| Mac | |
|
||||
| Mac | Working |
|
||||
| Windows | Working |
|
||||
| Linux | |
|
||||
|
|
|
|||
|
|
@ -8,17 +8,14 @@ Run the example and press `Ctrl/CMD+Shift+C` to center the focused window.
|
|||
To run the example, simply run the following command:
|
||||
|
||||
```bash
|
||||
go run main.go
|
||||
go run .
|
||||
```
|
||||
|
||||
# Status
|
||||
|
||||
| Platform | Status |
|
||||
|----------|----------------|
|
||||
| Mac | |
|
||||
| Windows | Mostly Working |
|
||||
| Linux | |
|
||||
| Platform | Status |
|
||||
|----------|---------|
|
||||
| Mac | Working |
|
||||
| Windows | Working |
|
||||
| Linux | |
|
||||
|
||||
## Known Issues
|
||||
|
||||
- [Some Keybindings not working on Windows](https://github.com/orgs/wailsapp/projects/6/views/1?pane=issue&itemId=40962823)
|
||||
|
|
@ -7,14 +7,14 @@ This example is a demonstration of different ways to create applications without
|
|||
To run the example, simply run the following command:
|
||||
|
||||
```bash
|
||||
go run main.go
|
||||
go run .
|
||||
```
|
||||
|
||||
# Status
|
||||
|
||||
| Platform | Status |
|
||||
|----------|---------|
|
||||
| Mac | |
|
||||
| Mac | Working |
|
||||
| Windows | Working |
|
||||
| Linux | |
|
||||
|
||||
|
|
|
|||
|
|
@ -7,13 +7,13 @@ This example is a demonstration of different ways to create applications without
|
|||
To run the example, simply run the following command:
|
||||
|
||||
```bash
|
||||
go run main.go
|
||||
go run .
|
||||
```
|
||||
|
||||
# Status
|
||||
|
||||
| Platform | Status |
|
||||
|----------|---------|
|
||||
| Mac | |
|
||||
| Mac | Working |
|
||||
| Windows | Working |
|
||||
| Linux | |
|
||||
|
|
|
|||
|
|
@ -7,13 +7,13 @@ This example will detect all attached screens and display their details.
|
|||
To run the example, simply run the following command:
|
||||
|
||||
```bash
|
||||
go run main.go
|
||||
go run .
|
||||
```
|
||||
|
||||
# Status
|
||||
|
||||
| Platform | Status |
|
||||
|----------|---------|
|
||||
| Mac | |
|
||||
| Mac | Working |
|
||||
| Windows | Working |
|
||||
| Linux | |
|
||||
|
|
|
|||
|
|
@ -22,11 +22,12 @@ func main() {
|
|||
systemTray := app.NewSystemTray()
|
||||
|
||||
window := app.NewWebviewWindowWithOptions(application.WebviewWindowOptions{
|
||||
Width: 500,
|
||||
Height: 800,
|
||||
Frameless: true,
|
||||
AlwaysOnTop: true,
|
||||
Hidden: true,
|
||||
Width: 500,
|
||||
Height: 800,
|
||||
Frameless: true,
|
||||
AlwaysOnTop: true,
|
||||
Hidden: true,
|
||||
DisableResize: true,
|
||||
ShouldClose: func(window *application.WebviewWindow) bool {
|
||||
window.Hide()
|
||||
return false
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@ This example is a demonstration of the Windows API.
|
|||
To run the example, simply run the following command:
|
||||
|
||||
```bash
|
||||
go run main.go
|
||||
go run .
|
||||
```
|
||||
|
||||
# Status
|
||||
|
|
|
|||
|
|
@ -7,13 +7,13 @@ This is an example of how to use the experimental WML, which provides HTMX style
|
|||
To run the example, simply run the following command:
|
||||
|
||||
```bash
|
||||
go run main.go
|
||||
go run .
|
||||
```
|
||||
|
||||
# Status
|
||||
|
||||
| Platform | Status |
|
||||
|----------|---------|
|
||||
| Mac | |
|
||||
| Mac | Working |
|
||||
| Windows | Working |
|
||||
| Linux | |
|
||||
|
|
|
|||
|
|
@ -582,7 +582,11 @@ func (a *App) CurrentWindow() *WebviewWindow {
|
|||
id := a.impl.getCurrentWindowID()
|
||||
a.windowsLock.RLock()
|
||||
defer a.windowsLock.RUnlock()
|
||||
return a.windows[id].(*WebviewWindow)
|
||||
result := a.windows[id]
|
||||
if result == nil {
|
||||
return nil
|
||||
}
|
||||
return result.(*WebviewWindow)
|
||||
}
|
||||
|
||||
func (a *App) Quit() {
|
||||
|
|
|
|||
File diff suppressed because one or more lines are too long
Loading…
Add table
Add a link
Reference in a new issue