Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
energye
energy
提交
01f88695
energy
项目概览
energye
/
energy
通知
13
Star
2
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
energy
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
前往新版Gitcode,体验更适合开发者的 AI 搜索 >>
提交
01f88695
编写于
3月 28, 2023
作者:
yanghye
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
upgrade-dev v2.3.47
上级
99271190
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
40 addition
and
27 deletion
+40
-27
cef/bind/v8-dynamic-type.go
cef/bind/v8-dynamic-type.go
+1
-1
cef/cef-v8-bind-render.go
cef/cef-v8-bind-render.go
+26
-24
example/dev-test/bind-event/bind-event.go
example/dev-test/bind-event/bind-event.go
+9
-2
pkgs/json/json.go
pkgs/json/json.go
+4
-0
未找到文件。
cef/bind/v8-dynamic-type.go
浏览文件 @
01f88695
...
...
@@ -26,7 +26,7 @@ import (
const
(
null
=
"null"
undefined
=
"
U
ndefined"
undefined
=
"
u
ndefined"
)
var
(
...
...
cef/cef-v8-bind-render.go
浏览文件 @
01f88695
...
...
@@ -55,7 +55,8 @@ func (m *bindRenderProcess) webKitMakeBind() {
for
item
:=
fields
.
Front
();
item
!=
nil
;
item
=
item
.
Next
()
{
jsv
:=
bind
.
ElementToJSValue
(
item
)
names
:=
strings
.
Split
(
jsv
.
Name
(),
"."
)
fmt
.
Println
(
"object ElementToJSValue Object:"
,
jsv
.
Name
())
fmt
.
Println
(
"object ElementToJSValue Object:"
,
jsv
.
Name
(),
jsv
.
Type
())
//fmt.Println("object:", object.ToJSONString())
if
len
(
names
)
==
1
{
if
jsv
.
IsObject
()
{
object
.
Set
(
jsv
.
Name
(),
json
.
NewJSONObject
(
nil
))
...
...
@@ -65,29 +66,30 @@ func (m *bindRenderProcess) webKitMakeBind() {
object
.
Set
(
jsv
.
Name
(),
jsv
.
JSON
()
.
Data
())
}
}
else
{
//for _, name := range jsv.Name()[:len(jsv.Name())-1] {
//
//}
//if jsv.IsObject() || jsv.IsArray() {
// fmt.Println("object ElementToJSValue Object:", strings.Join(jsv.Name(), "."), jsv.JSON().ToJSONString())
// for _, name := range jsv.Name() {
// if pObject := object.GetByKey(name); pObject != nil {
// if jsv.IsObject() {
// object.Set(strings.Join(jsv.Name(), "."), json.NewJSONObject(nil))
// } else if jsv.IsArray() {
// object.Set(strings.Join(jsv.Name(), "."), json.NewJSONArray(nil))
// }
// }
// }
// if jsv.IsObject() {
// object.Set(strings.Join(jsv.Name(), "."), json.NewJSONObject(nil))
// } else if jsv.IsArray() {
// object.Set(strings.Join(jsv.Name(), "."), json.NewJSONArray(nil))
// }
//} else {
// fmt.Println("object ElementToJSValue:", strings.Join(jsv.Name(), "."), jsv.JSON().ToJSONString())
// //object.Set(strings.Join(jsv.Name(), "."), jsv.JSON().Data())
//}
name
:=
names
[
len
(
names
)
-
1
]
var
pObject
=
object
for
i
:=
0
;
i
<
len
(
names
)
-
1
;
i
++
{
pObject
=
pObject
.
GetByKey
(
names
[
i
])
}
if
jsv
.
IsObject
()
{
if
pObject
.
IsArray
()
{
pObject
.
JSONArray
()
.
Add
(
json
.
NewJSONObject
(
nil
))
}
else
{
pObject
.
Set
(
name
,
json
.
NewJSONObject
(
nil
))
}
}
else
if
jsv
.
IsArray
()
{
if
pObject
.
IsObject
()
{
pObject
.
Set
(
name
,
json
.
NewJSONArray
(
nil
))
}
else
{
pObject
.
JSONArray
()
.
Add
(
json
.
NewJSONArray
(
nil
))
}
}
else
{
if
pObject
.
IsObject
()
{
pObject
.
Set
(
name
,
nil
)
}
else
if
pObject
.
IsArray
()
{
pObject
.
JSONArray
()
.
Add
(
nil
)
}
}
}
}
...
...
example/dev-test/bind-event/bind-event.go
浏览文件 @
01f88695
...
...
@@ -44,7 +44,7 @@ func main() {
fmt
.
Println
(
"nullKey"
,
nullKey
.
Value
())
undefinedKey
:=
bind
.
NewUndefined
(
"undefinedKey"
)
fmt
.
Println
(
"undefinedKey"
,
undefinedKey
.
Value
(),
undefinedKey
.
IsUndefined
())
funcKey
:=
bind
.
NewFunction
(
"funcKey"
,
func
()
{
funcKey
:=
bind
.
NewFunction
(
"funcKey"
,
func
(
i1
int
)
{
})
fmt
.
Println
(
"funcKey"
,
funcKey
)
...
...
@@ -79,7 +79,14 @@ func main() {
//Key4: 555.3,
//Key5: true,
//Key6: &objectDemo1{},
Key7
:
objectDemo2
{
Key4
:
&
objectDemo1
{}},
Key7
:
objectDemo2
{
Key4
:
&
objectDemo1
{},
},
Key8
:
make
([]
string
,
0
),
Key9
:
make
([]
objectDemo2
,
0
),
Key10
:
&
objectDemo2
{
Key5
:
make
([]
*
objectDemo1
,
0
),
},
}
bind
.
NewObject
(
testObj
)
bind
.
NewArray
(
"arrayKey"
,
"字符串"
,
100001
,
22222.333
,
true
,
testObj
)
...
...
pkgs/json/json.go
浏览文件 @
01f88695
...
...
@@ -260,6 +260,7 @@ func (m *JsonData) Add(value ...any) {
}
m
.
V
=
append
(
m
.
V
.
([]
any
),
tmp
...
)
m
.
S
+=
len
(
value
)
m
.
modifyParentValue
()
}
}
...
...
@@ -281,6 +282,7 @@ func (m *JsonData) SetByIndex(index int, value any) {
default
:
m
.
V
.
([]
any
)[
index
]
=
value
}
m
.
modifyParentValue
()
}
}
...
...
@@ -289,6 +291,7 @@ func (m *JsonData) RemoveByIndex(index int) {
v
:=
m
.
V
.
([]
any
)
m
.
V
=
append
(
v
[
:
index
],
v
[
index
+
1
:
]
...
)
m
.
S
--
m
.
modifyParentValue
()
}
}
...
...
@@ -534,6 +537,7 @@ func (m *JsonData) RemoveByKey(key string) {
if
_
,
ok
:=
m
.
V
.
(
map
[
string
]
any
)[
key
];
ok
{
delete
(
m
.
V
.
(
map
[
string
]
any
),
key
)
m
.
S
--
m
.
modifyParentValue
()
}
}
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录