From c650671265cedf55ac13df56080ce8d03eafb8a8 Mon Sep 17 00:00:00 2001 From: Lea Anthony Date: Fri, 3 Jul 2020 13:48:27 +1000 Subject: [PATCH] fix: vanilla template for windows --- cmd/templates/vanilla/frontend/src/main.js | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/cmd/templates/vanilla/frontend/src/main.js b/cmd/templates/vanilla/frontend/src/main.js index 9014dba59..6fd9f5c54 100644 --- a/cmd/templates/vanilla/frontend/src/main.js +++ b/cmd/templates/vanilla/frontend/src/main.js @@ -1,9 +1,8 @@ - +import 'core-js/stable'; const runtime = require('@wailsapp/runtime'); -// We need to wait for runtime.Init to complete before -// running our JS -runtime.Init(() => { +// Main entry point +function start() { // Ensure the default app div is 100% wide/high var app = document.getElementById('app'); @@ -20,9 +19,12 @@ runtime.Init(() => { `; // Connect button to Go method - document.getElementById('button').onclick = () => { - window.backend.basic().then((result) => { + document.getElementById('button').onclick = function() { + window.backend.basic().then( function(result) { document.getElementById('result').innerText = result; - }) - } -}); \ No newline at end of file + }); + }; +}; + +// We provide our entrypoint as a callback for runtime.Init +runtime.Init(start); \ No newline at end of file