Commit 2ddd6214 authored by Joel Martin's avatar Joel Martin

Add web-socket-js debug flag and default to off.

parent 76053e2b
......@@ -21,6 +21,7 @@ public class WebSocketMain extends Sprite {
private var policyLoaded:Boolean = false;
private var callerUrl:String;
private var debug:Boolean = false;
public function WebSocketMain() {
......@@ -42,6 +43,10 @@ public class WebSocketMain extends Sprite {
callerUrl = url;
}
public function setDebug(val:Boolean):void {
debug = val;
}
public function create(
url:String, protocol:String,
proxyHost:String = null, proxyPort:int = 0,
......@@ -70,7 +75,9 @@ public class WebSocketMain extends Sprite {
}
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 {
......
......@@ -255,7 +255,7 @@
WebSocket.__tasks = [];
WebSocket.__initialize = function() {
WebSocket.__initialize = function(debug) {
if (!WebSocket.__swfLocation) {
console.error("[WebSocket] set WebSocket.__swfLocation to location of WebSocketMain.swf");
return;
......@@ -283,6 +283,9 @@
//console.log("[WebSocket] FABridge initializad");
WebSocket.__flash = FABridge.webSocket.root();
WebSocket.__flash.setCallerUrl(location.href);
if (typeof debug !== "undefined") {
WebSocket.__flash.setDebug(debug);
}
for (var i = 0; i < WebSocket.__tasks.length; ++i) {
WebSocket.__tasks[i]();
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment