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:
@@ -2,7 +2,6 @@
|
||||
// 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 = {
|
||||
@@ -14,7 +13,7 @@ window.go.main = {
|
||||
* @param name {string}
|
||||
* @returns {Promise<string>}
|
||||
**/
|
||||
Greet: function(name) { wails.CallByID(1411160069, ...Array.prototype.slice.call(arguments, 0)); },
|
||||
Greet: function(name) { return wails.CallByID(1411160069, ...Array.prototype.slice.call(arguments, 0)); },
|
||||
|
||||
/**
|
||||
* GreetService.GreetPerson
|
||||
@@ -22,7 +21,6 @@ window.go.main = {
|
||||
* @param person {main.Person}
|
||||
* @returns {Promise<string>}
|
||||
**/
|
||||
GreetPerson: function(person) { wails.CallByID(4021313248, ...Array.prototype.slice.call(arguments, 0)); },
|
||||
GreetPerson: function(person) { return wails.CallByID(4021313248, ...Array.prototype.slice.call(arguments, 0)); },
|
||||
},
|
||||
};
|
||||
|
||||
|
||||
@@ -75,20 +75,20 @@
|
||||
<p class="button-42" onclick="window.open('https://wailsapp.github.io/wails/')">Documentation</p>
|
||||
<p class="button-42" onclick="window.open('https://wailsapp.github.io/wails/getting-started/feedback/')">Feedback</p>
|
||||
</div>
|
||||
<div class="result" id="result">{resultText}</div>
|
||||
<div class="result" id="result">Please enter your name below 👇</div>
|
||||
<div class="input-box" id="input">
|
||||
<input autocomplete="off" class="input" id="name" type="text"/>
|
||||
<button class="btn" onclick="greet">Greet</button>
|
||||
<button class="btn" onclick="greet()">Greet</button>
|
||||
</div>
|
||||
<script src='bindings_main.js'></script>
|
||||
<script>
|
||||
import {Greet} from '../assets/bindings_main.js';
|
||||
let resultText = "";
|
||||
let name = "";
|
||||
|
||||
let resultText = "Please enter your name below 👇"
|
||||
let name
|
||||
|
||||
function greet() {
|
||||
Greet(name).then(result => resultText = result)
|
||||
}
|
||||
function greet() {
|
||||
window.go.main.GreetService.Greet(document.getElementById("name").value).then((result) =>
|
||||
document.getElementById("result").innerHTML = result);
|
||||
}
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
</html>
|
||||
|
||||
Reference in New Issue
Block a user