-
Notifications
You must be signed in to change notification settings - Fork 22
/
send.go
38 lines (35 loc) · 1.03 KB
/
send.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
//----------------------------------------
//
// Copyright © yanghy. All Rights Reserved.
//
// Licensed under Apache License Version 2.0, January 2004
//
// https://www.apache.org/licenses/LICENSE-2.0
//
//----------------------------------------
package ipc
import (
"github.com/energye/energy/v2/cef/ipc/argument"
"github.com/energye/energy/v2/cef/ipc/target"
)
// emitSendToChannel
// trigger the specified target Go channel event
func emitSendToGoChannel(messageId int32, tag target.ITarget, eventName string, arguments []interface{}) {
message := &argument.List{
Id: messageId,
Name: InternalIPCGoExecuteGoEvent,
EventName: eventName,
Data: arguments,
}
if isMainProcess {
BrowserChan().IPC().Send(tag.ChannelId(), message.Bytes())
} else {
message.BId = RenderChan().BrowserId()
if tag.TargetType() == target.TgGoSub {
RenderChan().IPC().SendToChannel(tag.ChannelId(), message.Bytes())
} else if tag.TargetType() == target.TgGoMain {
RenderChan().IPC().Send(message.Bytes())
}
}
message.Reset()
}