10000 No network emulator on RestDoa · SaffronCode/SaffronCode@7b17304 · GitHub
[go: up one dir, main page]

Skip to content

Commit 7b17304

Browse files
committed
No network emulator on RestDoa
1 parent 67cc208 commit 7b17304

File tree

1 file changed

+16
-1
lines changed

1 file changed

+16
-1
lines changed

restDoaService/RestDoaServiceCaller.as

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,7 @@
6161

6262

6363
private static var webServiceId:uint = 0 ;
64+
private static var _fake_no_net:Boolean = false ;
6465

6566
public function get pureData():String
6667
{
@@ -158,6 +159,11 @@
158159
requestLoader.addEventListener(ProgressEvent.PROGRESS,dispatchProgress);
159160
}
160161

162+
public static function cutConnect(status:Boolean=true):void
163+
{
164+
_fake_no_net = status ;
165+
}
166+
161167
public function then(onResponded:Function):RestDoaServiceCaller
162168
{
163169
resultReturnedFunc = onResponded ;
@@ -583,7 +589,16 @@
583589
//debug line
584590
//navigateToURL(pureRequest);
585591
_isLoading = true ;
586-
requestLoader.load(pureRequest);
592+
if(_fake_no_net)
593+
{
594+
setTimeout(function():void{
595+
requestLoader.dispatchEvent(new IOErrorEvent(IOErrorEvent.IO_ERROR,true,false,'no net'));
596+
},100)
597+
}
598+
else
599+
{
600+
requestLoader.load(pureRequest);
601+
}
587602
//noInternet();
588603
}
589604

0 commit comments

Comments
 (0)
0