Skip to content

Instantly share code, notes, and snippets.

@asticode
Last active February 11, 2019 10:16
Show Gist options
  • Save asticode/5dfabac43db6ff14759f25180fc2c046 to your computer and use it in GitHub Desktop.
Save asticode/5dfabac43db6ff14759f25180fc2c046 to your computer and use it in GitHub Desktop.
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