Add web-socket-js debug flag and default to off.
This commit is contained in:
parent
76053e2bae
commit
2ddd6214a5
|
@ -21,6 +21,7 @@ public class WebSocketMain extends Sprite {
|
||||||
|
|
||||||
private var policyLoaded:Boolean = false;
|
private var policyLoaded:Boolean = false;
|
||||||
private var callerUrl:String;
|
private var callerUrl:String;
|
||||||
|
private var debug:Boolean = false;
|
||||||
|
|
||||||
public function WebSocketMain() {
|
public function WebSocketMain() {
|
||||||
|
|
||||||
|
@ -42,6 +43,10 @@ public class WebSocketMain extends Sprite {
|
||||||
callerUrl = url;
|
callerUrl = url;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function setDebug(val:Boolean):void {
|
||||||
|
debug = val;
|
||||||
|
}
|
||||||
|
|
||||||
public function create(
|
public function create(
|
||||||
url:String, protocol:String,
|
url:String, protocol:String,
|
||||||
proxyHost:String = null, proxyPort:int = 0,
|
proxyHost:String = null, proxyPort:int = 0,
|
||||||
|
@ -70,7 +75,9 @@ public class WebSocketMain extends Sprite {
|
||||||
}
|
}
|
||||||
|
|
||||||
public function log(message:String):void {
|
public function log(message:String):void {
|
||||||
ExternalInterface.call("webSocketLog", encodeURIComponent("[WebSocket] " + message));
|
if (debug) {
|
||||||
|
ExternalInterface.call("webSocketLog", encodeURIComponent("[WebSocket] " + message));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public function error(message:String):void {
|
public function error(message:String):void {
|
||||||
|
|
|
@ -255,7 +255,7 @@
|
||||||
|
|
||||||
WebSocket.__tasks = [];
|
WebSocket.__tasks = [];
|
||||||
|
|
||||||
WebSocket.__initialize = function() {
|
WebSocket.__initialize = function(debug) {
|
||||||
if (!WebSocket.__swfLocation) {
|
if (!WebSocket.__swfLocation) {
|
||||||
console.error("[WebSocket] set WebSocket.__swfLocation to location of WebSocketMain.swf");
|
console.error("[WebSocket] set WebSocket.__swfLocation to location of WebSocketMain.swf");
|
||||||
return;
|
return;
|
||||||
|
@ -283,6 +283,9 @@
|
||||||
//console.log("[WebSocket] FABridge initializad");
|
//console.log("[WebSocket] FABridge initializad");
|
||||||
WebSocket.__flash = FABridge.webSocket.root();
|
WebSocket.__flash = FABridge.webSocket.root();
|
||||||
WebSocket.__flash.setCallerUrl(location.href);
|
WebSocket.__flash.setCallerUrl(location.href);
|
||||||
|
if (typeof debug !== "undefined") {
|
||||||
|
WebSocket.__flash.setDebug(debug);
|
||||||
|
}
|
||||||
for (var i = 0; i < WebSocket.__tasks.length; ++i) {
|
for (var i = 0; i < WebSocket.__tasks.length; ++i) {
|
||||||
WebSocket.__tasks[i]();
|
WebSocket.__tasks[i]();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue