Last active
February 11, 2019 10:16
-
-
Save asticode/5dfabac43db6ff14759f25180fc2c046 to your computer and use it in GitHub Desktop.
This file contains 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": | |
// Unmarshal payload | |
var s string | |
if err = json.Unmarshal(m.Payload, &s); err != nil { | |
payload = err.Error() | |
return | |
} | |
payload = s + " world" | |
} | |
return | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment