mirror of
https://gitee.com/energye/energy.git
synced 2024-12-03 12:17:44 +08:00
upgrade-dev v2.1.15
This commit is contained in:
parent
4a63346139
commit
2476024f28
@ -84,6 +84,8 @@ func (m *contextCreate) makeIPC(context *ICefV8Context) {
|
|||||||
// ipcEmitExecute ipc.emit 执行
|
// ipcEmitExecute ipc.emit 执行
|
||||||
func (m *contextCreate) ipcEmitExecute(name string, object *ICefV8Value, arguments *TCefV8ValueArray, retVal *ResultV8Value, exception *Exception) bool {
|
func (m *contextCreate) ipcEmitExecute(name string, object *ICefV8Value, arguments *TCefV8ValueArray, retVal *ResultV8Value, exception *Exception) bool {
|
||||||
fmt.Println("emit handler name:", name, "arguments-size:", arguments.Size())
|
fmt.Println("emit handler name:", name, "arguments-size:", arguments.Size())
|
||||||
|
keyList := object.GetKeys()
|
||||||
|
fmt.Println("\tkeys:", keyList, keyList.Count(), keyList.Get(0), keyList.Get(1))
|
||||||
if name != internalEmit {
|
if name != internalEmit {
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
@ -123,6 +125,7 @@ func (m *contextCreate) ipcEmitExecute(name string, object *ICefV8Value, argumen
|
|||||||
if emitArgs != nil {
|
if emitArgs != nil {
|
||||||
argsLen := emitArgs.GetArrayLength()
|
argsLen := emitArgs.GetArrayLength()
|
||||||
for i := 0; i < argsLen; i++ {
|
for i := 0; i < argsLen; i++ {
|
||||||
|
//emitArgs.GetValueByKey()
|
||||||
fmt.Println("\temitArgs:", i, emitArgs.GetValueByIndex(i), emitArgs.GetValueByIndex(i).IsString())
|
fmt.Println("\temitArgs:", i, emitArgs.GetValueByIndex(i), emitArgs.GetValueByIndex(i).IsString())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -15,6 +15,7 @@ import (
|
|||||||
"github.com/energye/energy/common"
|
"github.com/energye/energy/common"
|
||||||
"github.com/energye/energy/common/imports"
|
"github.com/energye/energy/common/imports"
|
||||||
"github.com/energye/energy/consts"
|
"github.com/energye/energy/consts"
|
||||||
|
"github.com/energye/golcl/lcl"
|
||||||
"github.com/energye/golcl/lcl/api"
|
"github.com/energye/golcl/lcl/api"
|
||||||
"time"
|
"time"
|
||||||
"unsafe"
|
"unsafe"
|
||||||
@ -329,6 +330,7 @@ func (m *ICefV8Value) getValueByKey(key string) *ICefV8Value {
|
|||||||
|
|
||||||
// GetValueByKey export
|
// GetValueByKey export
|
||||||
func (m *ICefV8Value) GetValueByKey(key string) *ICefV8Value {
|
func (m *ICefV8Value) GetValueByKey(key string) *ICefV8Value {
|
||||||
|
// TODO 优化
|
||||||
if key == internalIPCKey {
|
if key == internalIPCKey {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
@ -398,10 +400,11 @@ func (m *ICefV8Value) SetValueByAccessor(key string, settings consts.TCefV8Acces
|
|||||||
return m.setValueByAccessor(key, settings, attribute)
|
return m.setValueByAccessor(key, settings, attribute)
|
||||||
}
|
}
|
||||||
|
|
||||||
//func (m *ICefV8Value) GetKeys(keys *lcl.TStrings) int32 {
|
func (m *ICefV8Value) GetKeys() *ICefV8ValueKeys {
|
||||||
// r1, _, _ := imports.Proc(internale_CefV8Value_GetKeys).Call(m.Instance(), keys.Instance())
|
var result uintptr
|
||||||
// return int32(r1)
|
r1, _, _ := imports.Proc(internale_CefV8Value_GetKeys).Call(m.Instance(), uintptr(unsafe.Pointer(&result)))
|
||||||
//}
|
return &ICefV8ValueKeys{keys: lcl.AsStrings(result), count: int(int32(r1))}
|
||||||
|
}
|
||||||
|
|
||||||
func (m *ICefV8Value) SetUserData(data *ICefV8Value) bool {
|
func (m *ICefV8Value) SetUserData(data *ICefV8Value) bool {
|
||||||
r1, _, _ := imports.Proc(internale_CefV8Value_SetUserData).Call(m.Instance(), data.Instance())
|
r1, _, _ := imports.Proc(internale_CefV8Value_SetUserData).Call(m.Instance(), data.Instance())
|
||||||
@ -657,3 +660,20 @@ func (*cefV8Value) NewPromise() *ICefV8Value {
|
|||||||
valueType: consts.V8vtPromise,
|
valueType: consts.V8vtPromise,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (m *ICefV8ValueKeys) Count() int {
|
||||||
|
if m == nil || m.keys == nil {
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
return m.count
|
||||||
|
}
|
||||||
|
|
||||||
|
func (m *ICefV8ValueKeys) Get(index int) string {
|
||||||
|
if m == nil || m.keys == nil {
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
if index < m.Count() {
|
||||||
|
return m.keys.Strings(int32(index))
|
||||||
|
}
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
@ -14,6 +14,7 @@ package cef
|
|||||||
import (
|
import (
|
||||||
. "github.com/energye/energy/consts"
|
. "github.com/energye/energy/consts"
|
||||||
. "github.com/energye/energy/types"
|
. "github.com/energye/energy/types"
|
||||||
|
"github.com/energye/golcl/lcl"
|
||||||
"time"
|
"time"
|
||||||
"unsafe"
|
"unsafe"
|
||||||
)
|
)
|
||||||
@ -321,6 +322,12 @@ type ICefV8Value struct {
|
|||||||
valueMaps map[int]*ICefV8Value
|
valueMaps map[int]*ICefV8Value
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ICefV8ValueKeys
|
||||||
|
type ICefV8ValueKeys struct {
|
||||||
|
keys *lcl.TStrings
|
||||||
|
count int
|
||||||
|
}
|
||||||
|
|
||||||
// TCefV8ValueArray ICefV8Value 数组的替代结构
|
// TCefV8ValueArray ICefV8Value 数组的替代结构
|
||||||
type TCefV8ValueArray struct {
|
type TCefV8ValueArray struct {
|
||||||
instance unsafe.Pointer
|
instance unsafe.Pointer
|
||||||
|
Loading…
Reference in New Issue
Block a user