QWebChannel 2019.1.9 → 2019.1.18
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/QWebChannel.rb +2 -2
- data/lib/QWebChannel/QObject.rb +12 -4
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d6425a8862df2126405215d7d558adc626823e92
|
4
|
+
data.tar.gz: af18a573275cc0ae50b37bbfd2b8c999fea9e1ab
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 64cbf10140ed651dc3c03ea0a913d36a66b73ec41a29e3323f5f556480e785b0fd55bc64a98a94cad6a0c8d8f216b240122ba11f1a0041deb1ada5128d5827e8
|
7
|
+
data.tar.gz: 202b5b2b7f4c8189a541c20ec85125fc64ebeb159d3cc08ae577f7aef8ae58d3ce52699785a49c7502a404a246ecd8f10a5596c9d21ccb3189e8da8f537f5c35
|
data/lib/QWebChannel.rb
CHANGED
@@ -158,9 +158,9 @@ class QWebChannel
|
|
158
158
|
object=QObject.new(objectName, data[objectName], @channel)
|
159
159
|
end
|
160
160
|
|
161
|
-
@channel.objects.each do |objectName, objectObject|
|
161
|
+
@channel.objects.each do |objectName, objectObject| #一个个地解析出属性。
|
162
162
|
@channel.objects[objectName].unwrapProperties()
|
163
|
-
end
|
163
|
+
end #@channel.objects.each do |objectName, objectObject| #一个个地解析出属性。
|
164
164
|
|
165
165
|
|
166
166
|
# puts "Self: #{self}"
|
data/lib/QWebChannel/QObject.rb
CHANGED
@@ -51,10 +51,12 @@ class QObject
|
|
51
51
|
return qObject
|
52
52
|
end #def unwrapQObject(response)
|
53
53
|
|
54
|
+
#解码出属性。
|
54
55
|
def unwrapProperties()
|
55
|
-
@object.__propertyCache__.each do |propertyIdx, propertyObject|
|
56
|
+
@object.__propertyCache__.each do |propertyIdx, propertyObject| #一个个地解码属性。
|
57
|
+
puts "propertyIdx: #{propertyIdx}" #Debug.
|
56
58
|
@object.__propertyCache__[propertyIdx]=@object.unwrapQObject(@object.__propertyCache__[propertyIdx])
|
57
|
-
end
|
59
|
+
end #@object.__propertyCache__.each do |propertyIdx, propertyObject| #一个个地解码属性。
|
58
60
|
end #def unwrapProperties()
|
59
61
|
|
60
62
|
def []=(signalName, signalObject)
|
@@ -79,10 +81,11 @@ class QObject
|
|
79
81
|
addSignal(notifySignalData, true)
|
80
82
|
end #if (notifySignalData)
|
81
83
|
|
82
|
-
defineProperty(propertyName) #定义属性。对应于Object.defineProperty.
|
84
|
+
defineProperty(propertyName, propertyIndex) #定义属性。对应于Object.defineProperty.
|
83
85
|
end #def bindGetterSetter(propertyInfo)
|
84
86
|
|
85
|
-
def defineProperty(propertyName)
|
87
|
+
def defineProperty(propertyName, propertyIndex)
|
88
|
+
@propertyNameIndexMap[propertyName]=propertyIndex #记录映射关系。
|
86
89
|
# define_property_by_prototype(propertyName)
|
87
90
|
|
88
91
|
|
@@ -90,6 +93,7 @@ class QObject
|
|
90
93
|
# self.class_eval( " def #{attr_name}; @#{attr_name}; end " )
|
91
94
|
self.instance_eval %Q{
|
92
95
|
def #{propertyName}
|
96
|
+
propertyIndex=@propertyNameIndexMap["#{propertyName}"] #获取属性索引。
|
93
97
|
@object.__propertyCache__[propertyIndex]
|
94
98
|
end
|
95
99
|
}
|
@@ -97,7 +101,9 @@ class QObject
|
|
97
101
|
#setter
|
98
102
|
self.instance_eval %Q{
|
99
103
|
def #{propertyName}=(val)
|
104
|
+
propertyIndex=@propertyNameIndexMap["#{propertyName}"] #获取属性索引。
|
100
105
|
|
106
|
+
|
101
107
|
@object.__propertyCache__[propertyIndex]=val
|
102
108
|
|
103
109
|
valueToSend=val
|
@@ -179,6 +185,8 @@ class QObject
|
|
179
185
|
@signalNameObjectHash={} #信号名字与信号对象的映射。
|
180
186
|
@__id__=name
|
181
187
|
@webChannel=webChannel
|
188
|
+
@propertyNameIndexMap={} #记录映射关系。属性名字与属性索引之间的映射关系。
|
189
|
+
|
182
190
|
webChannel.objects[name]=self
|
183
191
|
|
184
192
|
puts "__id__: #{@__id__}" #debug.
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: QWebChannel
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2019.1.
|
4
|
+
version: 2019.1.18
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Hxcan Cai
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-01-
|
11
|
+
date: 2019-01-18 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: websocket-eventmachine-client
|