Browse Source

Changing print() to console.log() to look more like other JS
environments. Also, removing exit() call in favor of a "Done!" log message.

Jay Sistar 10 years ago
parent
commit
72c5dec5bc
1 changed files with 4 additions and 4 deletions
  1. 4 4
      WebSocketExample/Resources/Scripts/main.js

+ 4 - 4
WebSocketExample/Resources/Scripts/main.js

@@ -12,7 +12,7 @@ var ws = web.makeWebSocket("ws://echo.websocket.org");
 // Listen for when the websocket is open
 ws.subscribeToEvent("open", function() {
 
-    print("WebSocket Opened");
+    console.log("WebSocket Opened");
     ws.send(JSON.stringify({
     	"test_key": "test_value",
     	"life_the_universe_and_everything": 42
@@ -23,7 +23,7 @@ ws.subscribeToEvent("open", function() {
 // Listen for messages
 ws.subscribeToEvent("message", function (event) {
 
-    print("WebSocket Message: " + event.data);
+    console.log("WebSocket Message: " + event.data);
 
     // We would normally keep the WebSocket open for a long time, but
     // here we are demonstrating how to use ws.openAgain() below, so
@@ -37,7 +37,7 @@ ws.subscribeToEvent("message", function (event) {
 // Listen for when the websocket is closed
 ws.subscribeToEvent("close", function() {
 
-    print("WebSocket Closed");
+    console.log("WebSocket Closed");
 
     if (num_times_to_connect) {
         num_times_to_connect--;
@@ -47,7 +47,7 @@ ws.subscribeToEvent("close", function() {
             ws.openAgain();
         }, 2000);
     } else {
-        Atomic.getEngine().exit();
+        console.log("Done!");
     }
 
 });