Support bindings, model & enum generation

This commit is contained in:
Lea Anthony
2023-12-12 21:51:40 +11:00
parent 43c4966873
commit 4b04c10f14
44 changed files with 3910 additions and 3126 deletions
+29
View File
@@ -0,0 +1,29 @@
// @ts-check
// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL
// This file is automatically generated. DO NOT EDIT
/**
* @typedef {import('./models').main.Title} mainTitle
* @typedef {import('./models').main.Person} mainPerson
*/
export const GreetService = {
/**
* GreetService.Greet
* Greet does XYZ
* @param name {string}
* @param title {mainTitle}
* @returns {Promise<string>}
**/
Greet: function(name, title) { return wails.CallByID(1411160069, ...Array.prototype.slice.call(arguments, 0)); },
/**
* GreetService.NewPerson
* NewPerson creates a new person
* @param name {string}
* @returns {Promise<mainPerson>}
**/
NewPerson: function(name) { return wails.CallByID(1661412647, ...Array.prototype.slice.call(arguments, 0)); },
};
+58
View File
@@ -0,0 +1,58 @@
package main
import (
_ "embed"
"log"
"github.com/wailsapp/wails/v3/pkg/application"
)
type Title string
const (
// Mister is a title
Mister Title = "Mr"
Miss Title = "Miss"
Ms Title = "Ms"
Mrs Title = "Mrs"
Dr Title = "Dr"
)
// GreetService is great
type GreetService struct {
SomeVariable int
lowerCase string
target *Person
}
type Person struct {
Title Title
Name string
}
// Greet does XYZ
func (*GreetService) Greet(name string, title Title) string {
return "Hello " + string(title) + " " + name
}
// NewPerson creates a new person
func (*GreetService) NewPerson(name string) *Person {
return &Person{Name: name}
}
func main() {
app := application.New(application.Options{
Bind: []interface{}{
&GreetService{},
},
})
app.NewWebviewWindow()
err := app.Run()
if err != nil {
log.Fatal(err)
}
}
+33
View File
@@ -0,0 +1,33 @@
// @ts-check
// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL
// This file is automatically generated. DO NOT EDIT
export namespace main {
export enum Title {
// Mister is a title
Mister = "Mr",
Miss = "Miss",
Ms = "Ms",
Mrs = "Mrs",
Dr = "Dr",
}
export class Person {
title: Title;
name: string;
constructor(source: Partial<Person> = {}) {
const { title = null, name = "" } = source;
this.title = title;
this.name = name;
}
static createFrom(source: string | object = {}): Person {
let parsedSource = typeof source === 'string' ? JSON.parse(source) : source;
return new Person(parsedSource as Partial<Person>);
}
}
}