mirror of
https://github.com/taigrr/wails.git
synced 2026-04-02 13:19:00 -07:00
Compare commits
4 Commits
feature/v2
...
419-encodi
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
d9f3f19f26 | ||
|
|
941bd439c6 | ||
|
|
d0c2d28311 | ||
|
|
7385bf48da |
@@ -30,3 +30,4 @@ Wails is what it is because of the time and effort given by these great people.
|
||||
* [Florian Didron](https://github.com/fdidron)
|
||||
* [Christopher Murphy](https://github.com/Splode)
|
||||
* [Zámbó, Levente](https://github.com/Lyimmi)
|
||||
* [artem](https://github.com/Unix4ever)
|
||||
|
||||
@@ -152,12 +152,19 @@ func (h *Bridge) NotifyEvent(event *messages.EventData) error {
|
||||
// Marshall the data
|
||||
data, err = json.Marshal(event.Data)
|
||||
if err != nil {
|
||||
h.log.Errorf("Cannot unmarshall JSON data in event: %s ", err.Error())
|
||||
h.log.Errorf("Cannot marshal JSON data in event: %s ", err.Error())
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
||||
message := "window.wails._.Notify('" + event.Name + "','" + string(data) + "')"
|
||||
// Double encode data to ensure everything is escaped correctly.
|
||||
data, err = json.Marshal(string(data))
|
||||
if err != nil {
|
||||
h.log.Errorf("Cannot marshal JSON data in event: %s ", err.Error())
|
||||
return err
|
||||
}
|
||||
|
||||
message := "window.wails._.Notify('" + event.Name + "'," + string(data) + ")"
|
||||
dead := []*session{}
|
||||
for _, session := range h.sessions {
|
||||
err := session.evalJS(message, notifyMessage)
|
||||
|
||||
@@ -329,7 +329,14 @@ func (w *WebView) NotifyEvent(event *messages.EventData) error {
|
||||
}
|
||||
}
|
||||
|
||||
message := fmt.Sprintf("wails._.Notify('%s','%s')", event.Name, data)
|
||||
// Double encode data to ensure everything is escaped correctly.
|
||||
data, err = json.Marshal(string(data))
|
||||
if err != nil {
|
||||
w.log.Errorf("Cannot marshal JSON data in event: %s ", err.Error())
|
||||
return err
|
||||
}
|
||||
|
||||
message := "window.wails._.Notify('" + event.Name + "'," + string(data) + ")"
|
||||
return w.evalJS(message)
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user