@@ -107,6 +107,7 @@ cc.Class({
107
107
this . _wsiSendBinary . binaryType = "arraybuffer" ;
108
108
this . _wsiSendBinary . onopen = function ( evt ) {
109
109
websocketLabel . textKey = i18n . t ( "cases/05_scripting/11_network/NetworkCtrl.js.5" ) ;
110
+ respLabel . string = "Opened!" ;
110
111
} ;
111
112
112
113
this . _wsiSendBinary . onmessage = function ( evt ) {
@@ -133,13 +134,15 @@ cc.Class({
133
134
134
135
this . _wsiSendBinary . onerror = function ( evt ) {
135
136
websocketLabel . textKey = i18n . t ( "cases/05_scripting/11_network/NetworkCtrl.js.7" ) ;
137
+ respLabel . string = "Error!" ;
136
138
} ;
137
139
138
140
this . _wsiSendBinary . onclose = function ( evt ) {
139
141
websocketLabel . textKey = i18n . t ( "cases/05_scripting/11_network/NetworkCtrl.js.8" ) ;
140
142
// After close, it's no longer possible to use it again,
141
143
// if you want to send another request, you need to create a new websocket instance
142
144
self . _wsiSendBinary = null ;
145
+ respLabel . string = "Close!" ;
143
146
} ;
144
147
145
148
this . scheduleOnce ( this . sendWebSocketBinary , 1 ) ;
@@ -189,6 +192,7 @@ cc.Class({
189
192
190
193
var msg = this . tag + " disconnected!" ;
191
194
this . socketIO . textKey = i18n . t ( "cases/05_scripting/11_network/NetworkCtrl.js.12" ) + msg ;
195
+ this . socketIOResp . string = msg ;
192
196
} ,
193
197
194
198
reconnecting : function ( ) {
@@ -254,7 +258,12 @@ cc.Class({
254
258
xhr [ "on" + eventname ] = function ( ) {
255
259
eventLabel . string = eventLabelOrigin + "\nEvent : " + eventname ;
256
260
if ( eventname === 'timeout' ) {
257
- label . string = '(timeout)' ;
261
+ label . string += '(timeout)' ;
262
+ }
263
+ else if ( eventname === 'loadend' ) {
264
+ if ( eventname !== '(timeout)' ) {
265
+ label . string += '...loadend!' ;
266
+ }
258
267
}
259
268
} ;
260
269
} ) ;
@@ -264,6 +273,21 @@ cc.Class({
264
273
if ( xhr . readyState === 4 && xhr . status >= 200 ) {
265
274
label . string = handler ( xhr . responseText ) ;
266
275
}
276
+ else if ( xhr . status === 404 ) {
277
+ label . string = "404 page not found!"
278
+ }
279
+ else if ( xhr . readyState === 3 ) {
280
+ label . string = "Request dealing!" ;
281
+ }
282
+ else if ( xhr . readyState === 2 ) {
283
+ label . string = "Request received!" ;
284
+ }
285
+ else if ( xhr . readyState === 1 ) {
286
+ label . string = "Server connection established! Request hasn't been received" ;
287
+ }
288
+ else if ( xhr . readyState === 0 ) {
289
+ label . string = "Request hasn't been initiated!" ;
290
+ }
267
291
} ;
268
292
} ,
269
293
0 commit comments