This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| package main | |
| import ( | |
| "flag" | |
| "github.com/asticode/go-astilectron" | |
| "github.com/asticode/go-astilectron-bootstrap" | |
| "github.com/asticode/go-astilog" | |
| "github.com/pkg/errors" | |
| ) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <!DOCTYPE html> | |
| <html lang="en"> | |
| <head> | |
| <meta charset="UTF-8"> | |
| <link rel="stylesheet" href="static/css/base.css"/> | |
| <link rel="stylesheet" href="static/lib/astiloader/astiloader.css"> | |
| <link rel="stylesheet" href="static/lib/astimodaler/astimodaler.css"> | |
| <link rel="stylesheet" href="static/lib/astinotifier/astinotifier.css"> | |
| <link rel="stylesheet" href="static/lib/font-awesome-4.7.0/css/font-awesome.min.css"> | |
| </head> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| * { | |
| box-sizing: border-box; | |
| } | |
| html, body { | |
| background-color: #fff; | |
| color: #333; | |
| height: 100%; | |
| margin: 0; | |
| width: 100%; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| let index = { | |
| init: function() { | |
| // Init | |
| asticode.loader.init(); | |
| asticode.modaler.init(); | |
| asticode.notifier.init(); | |
| } | |
| }; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // This will wait for the astilectron namespace to be ready | |
| document.addEventListener('astilectron-ready', function() { | |
| // This will send a message to GO | |
| astilectron.sendMessage({name: "event.name", payload: "hello"}, function(message) { | |
| console.log("received " + message.payload) | |
| }); | |
| }) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| func main() { | |
| bootstrap.Run(bootstrap.Options{ | |
| MessageHandler: handleMessages, | |
| }) | |
| } | |
| // handleMessages handles messages | |
| func handleMessages(_ *astilectron.Window, m bootstrap.MessageIn) (payload interface{}, err error) { | |
| switch m.Name { | |
| case "event.name": |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // This will send a message and execute a callback | |
| // Callbacks are optional | |
| bootstrap.SendMessage(w, "event.name", "hello", func(m *bootstrap.MessageIn) { | |
| // Unmarshal payload | |
| var s string | |
| json.Unmarshal(m.Payload, &s) | |
| // Process message | |
| log.Infof("received %s", s) | |
| }) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| let index = { | |
| addFolder(name, path) { | |
| let div = document.createElement("div"); | |
| div.className = "dir"; | |
| div.onclick = function() { index.explore(path) }; | |
| div.innerHTML = `<i class="fa fa-folder"></i><span>` + name + `</span>`; | |
| document.getElementById("dirs").appendChild(div) | |
| }, | |
| init: function() { | |
| // Wait for astilectron to be ready |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| package main | |
| import ( | |
| "encoding/json" | |
| "io/ioutil" | |
| "os" | |
| "os/user" | |
| "path/filepath" | |
| "sort" | |
| "strconv" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // This will wait for the astilectron namespace to be ready | |
| document.addEventListener('astilectron-ready', function() { | |
| // This will listen to messages sent by GO | |
| astilectron.onMessage(function(message) { | |
| // Process message | |
| if (message.name === "event.name") { | |
| return {payload: message.message + " world"}; | |
| } | |
| }); | |
| }) |
OlderNewer