mirror of
https://github.com/wailsapp/wails.git
synced 2025-05-02 22:49:31 +08:00
removed quote db for now. added vue basic
This commit is contained in:
parent
5994eb605f
commit
3ae88f8822
1
.gitignore
vendored
1
.gitignore
vendored
@ -15,3 +15,4 @@ examples/**/example*
|
||||
!examples/**/*.*
|
||||
cmd/wails/wails
|
||||
.DS_Store
|
||||
tmp
|
@ -30,6 +30,7 @@ window.wailsbridge = {
|
||||
overlayCSS:
|
||||
".wails-reconnect-overlay{position:fixed;top:0;left:0;width:100%;height:100%;background:rgba(0,0,0,.6);font-family:sans-serif;display:none;z-index:999999}.wails-reconnect-overlay-content{padding:20px 30px;text-align:center;width:20em;position:relative;height:14em;border-radius:1em;margin:5% auto 0;background-color:#fff;box-shadow:1px 1px 20px 3px;background-image:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAC8AAAAuCAMAAACPpbA7AAAAqFBMVEUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEBAQAAAAAAAAEBAQAAAAAAAAAAAAEBAQEBAQDAwMBAQEAAAABAQEAAAAAAAAAAAABAQEAAAAAAAACAgICAgIBAQEAAAAAAAAAAAAAAAAAAAAAAAABAQEAAAACAgIAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFBQWKCj6oAAAAN3RSTlMALiIqDhkGBAswJjP0GxP6NR4W9/ztjRDMhWU50G9g5eHXvbZ9XEI9xZTcqZl2aldKo55QwoCvZUgzhAAAAs9JREFUSMeNleeWqjAUhU0BCaH3Itiw9zKT93+zG02QK1hm/5HF+jzZJ6fQe6cyXE+jg9X7o9wxuylIIf4Tv2V3+bOrEXnf8dwQ/KQIGDN2/S+4OmVCVXL/ScBnfibxURqIByP/hONE8r8T+bDMlQ98KSl7Y8hzjpS8v1qtDh8u5f8KQpGpfnPPhqG8JeogN37Hq9eaN2xRhIwAaGnvws8F1ShxqK5ob2twYi1FAMD4rXsYtnC/JEiRbl4cUrCWhnMCLRFemXezXbb59QK4WASOsm6n2W1+4CBT2JmtzQ6fsrbGubR/NFbd2g5Y179+5w/GEHaKsHjYCet7CgrXU3txarNC7YxOVJtIj4/ERzMdZfzc31hp+8cD6eGILgarZY9uZ12hAs03vfBD9C171gS5Omz7OcvxALQIn4u8RRBBBcsi9WW2woO9ipLgfzpYlggg3ZRdROUC8KT7QLqq3W9KB5BbdFVg4929kdwp6+qaZnMCCNBdj+NyN1W885Ry/AL3D4AQbsVV4noCiM/C83kyYq80XlDAYQtralOiDzoRAHlotWl8q2tjvYlOgcg1A8jEApZa+C06TBdAz2Qv0wu11I/zZOyJQ6EwGez2P2b8PIQr1hwwnAZsAxwA4UAYOyXUxM/xp6tHAn4GUmPGM9R28oVxgC0e/zQJJI6DyhyZ1r7uzRQhpcW7x7vTaWSzKSG6aep77kroTEl3U81uSVaUTtgEINfC8epx+Q4F9SpplHG84Ek6m4RAq9/TLkOBrxyeuddZhHvGIp1XXfFy3Z3vtwNblKGiDn+J+92vwwABHghj7HnzlS1H5kB49AZvdGCFgiBPq69qfXPr3y++yilF0ON4R8eR7spAsLpZ95NqAW5tab1c4vkZm6aleajchMwYTdILQQTwE2OV411ZM9WztDjPql12caBi6gDpUKmDd4U1XNdQxZ4LIXQ5/Tr4P7I9tYcFrDK3AAAAAElFTkSuQmCC);background-repeat:no-repeat;background-position:center}.wails-reconnect-overlay-title{font-size:2em}.wails-reconnect-overlay-message{font-size:1.3em}.wails-reconnect-overlay-loadingspinner{pointer-events:none;width:2.5em;height:2.5em;border:.4em solid transparent;border-color:#3E67EC #eee #eee;border-radius:50%;animation:loadingspin 1s linear infinite;margin:auto;padding:2.5em}@keyframes loadingspin{100%{transform:rotate(360deg)}}",
|
||||
log: function(message) {
|
||||
// eslint-disable-next-line
|
||||
console.log(
|
||||
"%c wails bridge %c " + message + " ",
|
||||
"background: #aa0000; color: #fff; border-radius: 3px 0px 0px 3px; padding: 1px; font-size: 0.7rem",
|
||||
|
@ -1,29 +1,35 @@
|
||||
# frontend
|
||||
# vue basic
|
||||
|
||||
## Project setup
|
||||
|
||||
```
|
||||
npm install
|
||||
```
|
||||
|
||||
### Compiles and hot-reloads for development
|
||||
|
||||
```
|
||||
npm run serve
|
||||
```
|
||||
|
||||
### Compiles and minifies for production
|
||||
|
||||
```
|
||||
npm run build
|
||||
```
|
||||
|
||||
### Run your tests
|
||||
|
||||
```
|
||||
npm run test
|
||||
```
|
||||
|
||||
### Lints and fixes files
|
||||
|
||||
```
|
||||
npm run lint
|
||||
```
|
||||
|
||||
### Customize configuration
|
||||
|
||||
See [Configuration Reference](https://cli.vuejs.org/config/).
|
11109
cmd/templates/vuebasic/frontend/package-lock.json
generated
Normal file
11109
cmd/templates/vuebasic/frontend/package-lock.json
generated
Normal file
File diff suppressed because it is too large
Load Diff
1
cmd/templates/vuebasic/frontend/package.json.md5
Normal file
1
cmd/templates/vuebasic/frontend/package.json.md5
Normal file
@ -0,0 +1 @@
|
||||
2b79f883dc856221fc3265755d610e40
|
49
cmd/templates/vuebasic/frontend/package.json.template
Normal file
49
cmd/templates/vuebasic/frontend/package.json.template
Normal file
@ -0,0 +1,49 @@
|
||||
{
|
||||
"name": "{{.NPMProjectName}}",
|
||||
"author": "{{.Author.Name}}<{{.Author.Email}}>",
|
||||
"private": true,
|
||||
"scripts": {
|
||||
"serve": "vue-cli-service serve",
|
||||
"build": "vue-cli-service build",
|
||||
"lint": "vue-cli-service lint"
|
||||
},
|
||||
"dependencies": {
|
||||
"core-js": "^2.6.4",
|
||||
"vue": "^2.5.22"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@vue/cli-plugin-babel": "^3.4.0",
|
||||
"@vue/cli-plugin-eslint": "^3.4.0",
|
||||
"@vue/cli-service": "^3.4.0",
|
||||
"babel-eslint": "^10.0.1",
|
||||
"eslint": "^5.8.0",
|
||||
"eslint-plugin-vue": "^5.0.0",
|
||||
"eventsource-polyfill": "^0.9.6",
|
||||
"vue-template-compiler": "^2.5.21",
|
||||
"webpack-hot-middleware": "^2.24.3"
|
||||
},
|
||||
"eslintConfig": {
|
||||
"root": true,
|
||||
"env": {
|
||||
"node": true
|
||||
},
|
||||
"extends": [
|
||||
"plugin:vue/essential",
|
||||
"eslint:recommended"
|
||||
],
|
||||
"rules": {},
|
||||
"parserOptions": {
|
||||
"parser": "babel-eslint"
|
||||
}
|
||||
},
|
||||
"postcss": {
|
||||
"plugins": {
|
||||
"autoprefixer": {}
|
||||
}
|
||||
},
|
||||
"browserslist": [
|
||||
"> 1%",
|
||||
"last 2 versions",
|
||||
"not ie <= 8"
|
||||
]
|
||||
}
|
Before Width: | Height: | Size: 1.1 KiB After Width: | Height: | Size: 1.1 KiB |
@ -5,11 +5,11 @@
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||
<meta name="viewport" content="width=device-width,initial-scale=1.0">
|
||||
<link rel="icon" href="<%= BASE_URL %>favicon.ico">
|
||||
<title>frontend</title>
|
||||
<title>my-vue-app-01</title>
|
||||
</head>
|
||||
<body>
|
||||
<noscript>
|
||||
<strong>We're sorry but frontend doesn't work properly without JavaScript enabled. Please enable it to continue.</strong>
|
||||
<strong>We're sorry but my-vue-app-01 doesn't work properly without JavaScript enabled. Please enable it to continue.</strong>
|
||||
</noscript>
|
||||
<div id="app"></div>
|
||||
<!-- built files will be auto injected -->
|
@ -1,22 +1,18 @@
|
||||
<template>
|
||||
<div id="app">
|
||||
<img alt="Wails logo" src="./assets/images/logo.png" class="logo zoomIn">
|
||||
<HelloWorld msg="Welcome to Your Wails App!"/>
|
||||
<Quote/>
|
||||
<HelloWorld/>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import HelloWorld from "./components/HelloWorld.vue";
|
||||
import Quote from "./components/Quote.vue";
|
||||
import "./assets/css/main.css";
|
||||
|
||||
export default {
|
||||
name: "app",
|
||||
components: {
|
||||
HelloWorld,
|
||||
Quote
|
||||
HelloWorld
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
@ -10,21 +10,6 @@
|
||||
html {
|
||||
height: 100%;
|
||||
overflow: hidden;
|
||||
/* https://leaverou.github.io/css3patterns/#carbon */
|
||||
background: linear-gradient(27deg, #151515 5px, transparent 5px) 0 5px,
|
||||
linear-gradient(207deg, #151515 5px, transparent 5px) 10px 0,
|
||||
linear-gradient(27deg, #222 5px, transparent 5px) 0 10px,
|
||||
linear-gradient(207deg, #222 5px, transparent 5px) 10px 5px,
|
||||
linear-gradient(90deg, #1b1b1b 10px, transparent 10px),
|
||||
linear-gradient(
|
||||
#1d1d1d 25%,
|
||||
#1a1a1a 25%,
|
||||
#1a1a1a 50%,
|
||||
transparent 50%,
|
||||
transparent 75%,
|
||||
#242424 75%,
|
||||
#242424
|
||||
);
|
||||
background-color: #131313;
|
||||
background-size: 20px 20px;
|
||||
}
|
Before Width: | Height: | Size: 48 KiB After Width: | Height: | Size: 48 KiB |
Before Width: | Height: | Size: 301 KiB After Width: | Height: | Size: 301 KiB |
@ -0,0 +1,55 @@
|
||||
<template>
|
||||
<div class="container">
|
||||
<h1>{{message}}</h1>
|
||||
<a @click="getMessage">Press Me!</a>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
message: " "
|
||||
};
|
||||
},
|
||||
methods: {
|
||||
getMessage: function() {
|
||||
var self = this;
|
||||
window.backend.basic().then(result => {
|
||||
self.message = result;
|
||||
});
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
||||
<!-- Add "scoped" attribute to limit CSS to this component only -->
|
||||
<style scoped>
|
||||
h1 {
|
||||
margin-top: 2em;
|
||||
position: relative;
|
||||
min-height: 5rem;
|
||||
width: 100%;
|
||||
}
|
||||
a:hover {
|
||||
font-size: 1.7em;
|
||||
border-color: blue;
|
||||
background-color: blue;
|
||||
color: white;
|
||||
border: 3px solid white;
|
||||
border-radius: 10px;
|
||||
padding: 9px;
|
||||
cursor: pointer;
|
||||
transition: 500ms;
|
||||
}
|
||||
a {
|
||||
font-size: 1.7em;
|
||||
border-color: white;
|
||||
background-color: #121212;
|
||||
color: white;
|
||||
border: 3px solid white;
|
||||
border-radius: 10px;
|
||||
padding: 9px;
|
||||
cursor: pointer;
|
||||
}
|
||||
</style>
|
12
cmd/templates/vuebasic/frontend/src/main.js
Normal file
12
cmd/templates/vuebasic/frontend/src/main.js
Normal file
@ -0,0 +1,12 @@
|
||||
import Vue from "vue";
|
||||
import App from "./App.vue";
|
||||
|
||||
Vue.config.productionTip = false;
|
||||
|
||||
import Bridge from "./wailsbridge";
|
||||
|
||||
Bridge.Start(() => {
|
||||
new Vue({
|
||||
render: h => h(App)
|
||||
}).$mount("#app");
|
||||
});
|
17
cmd/templates/vuebasic/frontend/src/wailsbridge.js
Normal file
17
cmd/templates/vuebasic/frontend/src/wailsbridge.js
Normal file
@ -0,0 +1,17 @@
|
||||
/*
|
||||
Wails Bridge (c) 2019-present Lea Anthony
|
||||
|
||||
This prod version is to get around having to rewrite your code
|
||||
for production. When doing a release build, this file will be used
|
||||
instead of the full version.
|
||||
*/
|
||||
|
||||
export default {
|
||||
// The main function
|
||||
// Passes the main Wails object to the callback if given.
|
||||
Start: function(callback) {
|
||||
if (callback) {
|
||||
window.wails.events.on("wails:ready", callback);
|
||||
}
|
||||
}
|
||||
};
|
43
cmd/templates/vuebasic/frontend/vue.config.js
Normal file
43
cmd/templates/vuebasic/frontend/vue.config.js
Normal file
@ -0,0 +1,43 @@
|
||||
let cssConfig = {};
|
||||
|
||||
if (process.env.NODE_ENV == "production") {
|
||||
cssConfig = {
|
||||
extract: {
|
||||
filename: "[name].css",
|
||||
chunkFilename: "[name].css"
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
chainWebpack: config => {
|
||||
let limit = 9999999999999999;
|
||||
config.module
|
||||
.rule("images")
|
||||
.test(/\.(png|gif|jpg)(\?.*)?$/i)
|
||||
.use("url-loader")
|
||||
.loader("url-loader")
|
||||
.tap(options => Object.assign(options, { limit: limit }));
|
||||
config.module
|
||||
.rule("fonts")
|
||||
.test(/\.(woff2?|eot|ttf|otf|svg)(\?.*)?$/i)
|
||||
.use("url-loader")
|
||||
.loader("url-loader")
|
||||
.options({
|
||||
limit: limit
|
||||
});
|
||||
},
|
||||
css: cssConfig,
|
||||
configureWebpack: {
|
||||
output: {
|
||||
filename: "[name].js"
|
||||
},
|
||||
optimization: {
|
||||
splitChunks: false
|
||||
}
|
||||
},
|
||||
devServer: {
|
||||
disableHostCheck: true,
|
||||
host: "localhost"
|
||||
}
|
||||
};
|
@ -5,6 +5,10 @@ import (
|
||||
"github.com/wailsapp/wails"
|
||||
)
|
||||
|
||||
func basic() string {
|
||||
return "Hello World!"
|
||||
}
|
||||
|
||||
func main() {
|
||||
|
||||
assets := packr.NewBox("./frontend/dist")
|
||||
@ -16,6 +20,6 @@ func main() {
|
||||
JS: wails.BoxString(&assets, "app.js"),
|
||||
CSS: wails.BoxString(&assets, "app.css"),
|
||||
})
|
||||
app.Bind(newQuotesCollection())
|
||||
app.Bind(basic)
|
||||
app.Run()
|
||||
}
|
@ -1,5 +1,5 @@
|
||||
{
|
||||
"name": "Vue2/Webpack",
|
||||
"name": "Vue2/Webpack Basic",
|
||||
"shortdescription": "A basic Vue2/WebPack4 template",
|
||||
"description": "A basic template using Vue 2 and bundled using Webpack 4",
|
||||
"author": "Lea Anthony<lea.anthony@gmail.com>",
|
@ -1,3 +0,0 @@
|
||||
> 1%
|
||||
last 2 versions
|
||||
not ie <= 8
|
@ -1,18 +0,0 @@
|
||||
{
|
||||
"name": "{{.NPMProjectName}}",
|
||||
"author": "{{.Author.Name}}<{{.Author.Email}}>",
|
||||
"version": "0.1.0",
|
||||
"private": true,
|
||||
"scripts": {
|
||||
"serve": "vue-cli-service serve",
|
||||
"build": "vue-cli-service build"
|
||||
},
|
||||
"dependencies": {
|
||||
"vue": "^2.5.17"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@vue/cli-plugin-babel": "^3.1.1",
|
||||
"@vue/cli-service": "^3.1.4",
|
||||
"vue-template-compiler": "^2.5.17"
|
||||
}
|
||||
}
|
@ -1,5 +0,0 @@
|
||||
module.exports = {
|
||||
plugins: {
|
||||
autoprefixer: {}
|
||||
}
|
||||
}
|
@ -1,79 +0,0 @@
|
||||
/**
|
||||
Credit: https://codepen.io/harmputman/pen/IpAnb
|
||||
**/
|
||||
|
||||
body {
|
||||
font: normal 300 1em/1.5em sans-serif;
|
||||
}
|
||||
|
||||
.container {
|
||||
background: #fff;
|
||||
width: 100%;
|
||||
max-width: 480px;
|
||||
min-width: 320px;
|
||||
margin: 2em auto 0;
|
||||
padding: 1.5em;
|
||||
opacity: 0.8;
|
||||
border-radius: 1em;
|
||||
border-color: #117;
|
||||
}
|
||||
|
||||
p {
|
||||
margin-bottom: 1.5em;
|
||||
}
|
||||
p:last-child {
|
||||
margin-bottom: 0;
|
||||
}
|
||||
|
||||
blockquote {
|
||||
display: block;
|
||||
border-width: 2px 0;
|
||||
border-style: solid;
|
||||
border-color: #eee;
|
||||
padding: 1.5em 0 0.5em;
|
||||
margin: 1.5em 0;
|
||||
position: relative;
|
||||
color: #117;
|
||||
}
|
||||
blockquote:before {
|
||||
content: "\201C";
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: 50%;
|
||||
transform: translate(-50%, -50%);
|
||||
background: #fff;
|
||||
width: 3rem;
|
||||
height: 2rem;
|
||||
font: 6em/1.08em sans-serif;
|
||||
color: #666;
|
||||
text-align: center;
|
||||
}
|
||||
blockquote:after {
|
||||
content: "\2013 \2003" attr(cite);
|
||||
display: block;
|
||||
text-align: right;
|
||||
font-size: 0.875em;
|
||||
color: #e70000;
|
||||
}
|
||||
|
||||
/* https://fdossena.com/?p=html5cool/buttons/i.frag */
|
||||
button {
|
||||
display: inline-block;
|
||||
padding: 0.35em 1.2em;
|
||||
border: 0.1em solid #000;
|
||||
margin: 0 0.3em 0.3em 0;
|
||||
border-radius: 0.12em;
|
||||
box-sizing: border-box;
|
||||
text-decoration: none;
|
||||
font-family: "Roboto", sans-serif;
|
||||
font-weight: 300;
|
||||
font-size: 1em;
|
||||
color: #000;
|
||||
text-align: center;
|
||||
transition: all 0.2s;
|
||||
}
|
||||
button:hover {
|
||||
color: #fff;
|
||||
background-color: #000;
|
||||
cursor: pointer;
|
||||
}
|
@ -1,38 +0,0 @@
|
||||
<template>
|
||||
<div class="hello">
|
||||
<h1>{{ msg }}</h1>
|
||||
<p></p>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
name: "HelloWorld",
|
||||
props: {
|
||||
msg: String
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
||||
<!-- Add "scoped" attribute to limit CSS to this component only -->
|
||||
<style scoped>
|
||||
.hello {
|
||||
margin-top: 2em;
|
||||
position: relative;
|
||||
width: 100%;
|
||||
}
|
||||
h3 {
|
||||
margin: 40px 0 0;
|
||||
}
|
||||
ul {
|
||||
list-style-type: none;
|
||||
padding: 0;
|
||||
}
|
||||
li {
|
||||
display: inline-block;
|
||||
margin: 0 10px;
|
||||
}
|
||||
a {
|
||||
color: gold;
|
||||
}
|
||||
</style>
|
@ -1,58 +0,0 @@
|
||||
<template>
|
||||
<div class="container">
|
||||
<blockquote v-if="quote != null" :cite="quote.person">{{ quote.text }}</blockquote>
|
||||
<p></p>
|
||||
<button @click="getNewQuote()">Get new Quote</button>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import "../assets/css/quote.css";
|
||||
import { eventBus } from "../main";
|
||||
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
quote: null
|
||||
};
|
||||
},
|
||||
methods: {
|
||||
getNewQuote: function() {
|
||||
var self = this;
|
||||
backend.QuotesCollection.GetQuote().then(result => {
|
||||
self.quote = result;
|
||||
});
|
||||
}
|
||||
},
|
||||
created() {
|
||||
if( !backend ) {
|
||||
eventBus.$on("ready", this.getNewQuote);
|
||||
} else {
|
||||
this.getNewQuote();
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
||||
<!-- Add "scoped" attribute to limit CSS to this component only -->
|
||||
<style scoped>
|
||||
.hello {
|
||||
margin-top: 2em;
|
||||
position: relative;
|
||||
width: 100%;
|
||||
}
|
||||
h3 {
|
||||
margin: 40px 0 0;
|
||||
}
|
||||
ul {
|
||||
list-style-type: none;
|
||||
padding: 0;
|
||||
}
|
||||
li {
|
||||
display: inline-block;
|
||||
margin: 0 10px;
|
||||
}
|
||||
a {
|
||||
color: gold;
|
||||
}
|
||||
</style>
|
@ -1,13 +0,0 @@
|
||||
import Vue from "vue";
|
||||
export const eventBus = new Vue();
|
||||
|
||||
import App from "./App.vue";
|
||||
new Vue({
|
||||
render: h => h(App)
|
||||
}).$mount("#app");
|
||||
|
||||
import Bridge from "./wailsbridge";
|
||||
Bridge.OnReady(() => {
|
||||
eventBus.$emit("ready");
|
||||
});
|
||||
Bridge.Start();
|
@ -1,35 +0,0 @@
|
||||
|
||||
module.exports = {
|
||||
chainWebpack: (config) => {
|
||||
let limit = 9999999999999999;
|
||||
config.module
|
||||
.rule('images')
|
||||
.test(/\.(png|gif|jpg)(\?.*)?$/i)
|
||||
.use('url-loader')
|
||||
.loader('url-loader')
|
||||
.tap(options => Object.assign(options, { limit: limit }));
|
||||
config.module
|
||||
.rule('fonts')
|
||||
.test(/\.(woff2?|eot|ttf|otf|svg)(\?.*)?$/i)
|
||||
.use('url-loader')
|
||||
.loader('url-loader')
|
||||
.options({
|
||||
limit: limit,
|
||||
})
|
||||
},
|
||||
css: {
|
||||
extract: {
|
||||
filename: '[name].css',
|
||||
chunkFilename: '[name].css',
|
||||
}
|
||||
},
|
||||
configureWebpack: {
|
||||
output: {
|
||||
filename: '[name].js',
|
||||
},
|
||||
optimization: {
|
||||
splitChunks: false
|
||||
}
|
||||
},
|
||||
|
||||
}
|
@ -1,61 +0,0 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"math/rand"
|
||||
"time"
|
||||
)
|
||||
|
||||
// Quote holds a single quote and the person who said it
|
||||
type Quote struct {
|
||||
Text string `json:"text"`
|
||||
Person string `json:"person"`
|
||||
}
|
||||
|
||||
// QuotesCollection holds a collection of quotes!
|
||||
type QuotesCollection struct {
|
||||
quotes []*Quote
|
||||
}
|
||||
|
||||
// AddQuote creates a Quote object with the given inputs and
|
||||
// adds it to the Quotes collection
|
||||
func (Q *QuotesCollection) AddQuote(text, person string) {
|
||||
Q.quotes = append(Q.quotes, &Quote{Text: text, Person: person})
|
||||
}
|
||||
|
||||
// GetQuote returns a random Quote object from the Quotes collection
|
||||
func (Q *QuotesCollection) GetQuote() *Quote {
|
||||
return Q.quotes[rand.Intn(len(Q.quotes))]
|
||||
}
|
||||
|
||||
// newQuotesCollection creates a new QuotesCollection
|
||||
func newQuotesCollection() *QuotesCollection {
|
||||
result := &QuotesCollection{}
|
||||
rand.Seed(time.Now().Unix())
|
||||
result.AddQuote("Age is an issue of mind over matter. If you don't mind, it doesn't matter", "Mark Twain")
|
||||
result.AddQuote("Anyone who stops learning is old, whether at twenty or eighty. Anyone who keeps learning stays young. The greatest thing in life is to keep your mind young", "Henry Ford")
|
||||
result.AddQuote("Wrinkles should merely indicate where smiles have been", "Mark Twain")
|
||||
result.AddQuote("True terror is to wake up one morning and discover that your high school class is running the country", "Kurt Vonnegut")
|
||||
result.AddQuote("A diplomat is a man who always remembers a woman's birthday but never remembers her age", "Robert Frost")
|
||||
result.AddQuote("As I grow older, I pay less attention to what men say. I just watch what they do", "Andrew Carnegie")
|
||||
result.AddQuote("How incessant and great are the ills with which a prolonged old age is replete", "C. S. Lewis")
|
||||
result.AddQuote("Old age, believe me, is a good and pleasant thing. It is true you are gently shouldered off the stage, but then you are given such a comfortable front stall as spectator", "Confucius")
|
||||
result.AddQuote("Old age has deformities enough of its own. It should never add to them the deformity of vice", "Eleanor Roosevelt")
|
||||
result.AddQuote("Nobody grows old merely by living a number of years. We grow old by deserting our ideals. Years may wrinkle the skin, but to give up enthusiasm wrinkles the soul", "Samuel Ullman")
|
||||
result.AddQuote("An archaeologist is the best husband a woman can have. The older she gets the more interested he is in her", "Agatha Christie")
|
||||
result.AddQuote("All diseases run into one, old age", "Ralph Waldo Emerson")
|
||||
result.AddQuote("Bashfulness is an ornament to youth, but a reproach to old age", "Aristotle")
|
||||
result.AddQuote("Like everyone else who makes the mistake of getting older, I begin each day with coffee and obituaries", "Bill Cosby")
|
||||
result.AddQuote("Age appears to be best in four things old wood best to burn, old wine to drink, old friends to trust, and old authors to read", "Francis Bacon")
|
||||
result.AddQuote("None are so old as those who have outlived enthusiasm", "Henry David Thoreau")
|
||||
result.AddQuote("Every man over forty is a scoundrel", "George Bernard Shaw")
|
||||
result.AddQuote("Forty is the old age of youth fifty the youth of old age", "Victor Hugo")
|
||||
result.AddQuote("You can't help getting older, but you don't have to get old", "George Burns")
|
||||
result.AddQuote("Alas, after a certain age every man is responsible for his face", "Albert Camus")
|
||||
result.AddQuote("Youth is when you're allowed to stay up late on New Year's Eve. Middle age is when you're forced to", "Bill Vaughan")
|
||||
result.AddQuote("Old age is like everything else. To make a success of it, you've got to start young", "Theodore Roosevelt")
|
||||
result.AddQuote("A comfortable old age is the reward of a well-spent youth. Instead of its bringing sad and melancholy prospects of decay, it would give us hopes of eternal youth in a better world", "Maurice Chevalier")
|
||||
result.AddQuote("A man growing old becomes a child again", "Sophocles")
|
||||
result.AddQuote("I will never be an old man. To me, old age is always 15 years older than I am", "Francis Bacon")
|
||||
result.AddQuote("Age considers youth ventures", "Rabindranath Tagore")
|
||||
return result
|
||||
}
|
@ -118,11 +118,6 @@ func (h *Headless) start(conn *websocket.Conn) {
|
||||
wailsRuntime := BoxString(&defaultAssets, "wails.js")
|
||||
h.evalJS(wailsRuntime, wailsRuntimeMessage)
|
||||
|
||||
// Inject the initial JS
|
||||
for _, js := range h.initialisationJS {
|
||||
h.sendMessage(h.theConnection, js)
|
||||
}
|
||||
|
||||
// Inject bindings
|
||||
for _, binding := range h.bindingCache {
|
||||
h.evalJS(binding, bindingMessage)
|
||||
|
Loading…
Reference in New Issue
Block a user