mirror of
https://github.com/wavetermdev/wails.git
synced 2026-08-05 13:53:43 -07:00
[v3 examples/bindings] correct binding output + example
- disable output of `import <model> from models` line - update README to generate bindings in usable location for HTML - update HTML to reference bindings correctly - update javascript to call and process the bound Greet function
This commit is contained in:
@@ -22,7 +22,7 @@ const bindingTemplate = `
|
||||
* @param name {string}
|
||||
* @returns {Promise<string>}
|
||||
**/
|
||||
{{methodName}}: function({{inputs}}) { wails.CallByID({{ID}}, ...Array.prototype.slice.call(arguments, 0)); },
|
||||
{{methodName}}: function({{inputs}}) { return wails.CallByID({{ID}}, ...Array.prototype.slice.call(arguments, 0)); },
|
||||
`
|
||||
|
||||
var reservedWords = []string{
|
||||
@@ -248,17 +248,18 @@ window.go = window.go || {};
|
||||
result[normalisedPackageNames[packageName]] += "};\n"
|
||||
|
||||
// add imports
|
||||
if len(allModels) > 0 {
|
||||
allModels := lo.Uniq(allModels)
|
||||
var models []string
|
||||
for _, model := range allModels {
|
||||
models = append(models, normalisedPackageNames[model])
|
||||
}
|
||||
sort.Strings(models)
|
||||
result[normalisedPackageNames[packageName]] += "\n"
|
||||
imports := "import {" + strings.Join(models, ", ") + "} from './models';\n"
|
||||
result[normalisedPackageNames[packageName]] = imports + result[normalisedPackageNames[packageName]]
|
||||
}
|
||||
/* if len(allModels) > 0 {
|
||||
allModels := lo.Uniq(allModels)
|
||||
var models []string
|
||||
for _, model := range allModels {
|
||||
models = append(models, normalisedPackageNames[model])
|
||||
}
|
||||
sort.Strings(models)
|
||||
result[normalisedPackageNames[packageName]] += "\n"
|
||||
imports := "import {" + strings.Join(models, ", ") + "} from './models';\n"
|
||||
result[normalisedPackageNames[packageName]] = imports + result[normalisedPackageNames[packageName]]
|
||||
}
|
||||
*/
|
||||
|
||||
result[normalisedPackageNames[packageName]] = header + result[normalisedPackageNames[packageName]]
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user