asticode / go-astilectron

Build cross platform GUI apps with GO and HTML/JS/CSS (powered by Electron)
MIT License
4.91k stars 343 forks source link

Isomorphic Go #72

Open peternoyes opened 6 years ago

peternoyes commented 6 years ago

I would be interested in writing the front end code in Go as well and transpiling it to JavaScript using Gopherjs. I suppose I could do it now by first running gopherjs in the resources folder before running the bundler but it would be nice if it were integrated into the process.

Also, forgive me but I am really new to this. I am wondering where you see the javascript console messages, is there any way to inspect? I have never dealt with Electron before.

asticode commented 6 years ago

I'll think about a clean way to integrate this into the process event though I doubt there's one. But I'll try.

Regarding the console messages, you have to put the DevTools attribute of the WindowOptions.WebPreferences struct to true and when the window will be created, the dev tools will appear as well.

Noofbiz commented 6 years ago

Gopherjs has a neat front end in go library https://github.com/gopherjs/vecty that could be pretty cool for something like that, not sure if it could work with electron though

peternoyes commented 6 years ago

Yup! I would definitely be using Vecty if we could get this to work.

ghost commented 6 years ago

i think you should just use WASM. Its easier than gopherjs in many ways.

here is a great golang WASM repo where the smart dev has also wrapped on the the Browser API. Because its WASM its must easier to write golang code.

https://github.com/lazyhacker/wasmgo/blob/master/test.go

see the import !!!

--

So maybe this can be used for also interacting with Electron API or wrapping the existing AstiElectron code or something in the middle.

ghost commented 6 years ago

The Perfect match.

https://go.isomorphicgo.org/

This is gopherjs based and pretty good. The use of standard template i particularly like..

I think it would be pretty easy to get it working as WASM and so get a speed bump too.

ghost commented 6 years ago

@peternoyes

I am leaning heavily towards Vecty now. I tried out react and vue already... https://github.com/gopherjs/vecty

Here is why !!! With the official golang compiler support for WASM now being in Master its game on for WASM and golang. So Vecty is now easily the mostly logical choice. SO you can develop all of your stack with golang and its all strongly typed.

So now you can use all goalng for your communication easily and GRPC is the best choice because you get fast bidirectional comms and codegeneration of all your types.

Then for styling there is Vecty MDC now !!!! https://github.com/agamigo/vecty-material

In summary i feel a demo can be made bringing all this together pretty easily. I really think that this is a huge opportunity for Astilectron and golanf developers that have been screaming for a good way to quickly built high quality app.

You can easily make Mobile webview apps using the Flutter Webview too BTW !!