diff options
author | Joe George <joe@zeroc.com> | 2014-10-16 14:42:31 -0400 |
---|---|---|
committer | Joe George <joe@zeroc.com> | 2014-10-16 14:42:31 -0400 |
commit | 8fb38cf1e5f8db5e4285ae43a77b0ba432b51cc6 (patch) | |
tree | db3e270275f650bdc364987913a741a949833bba | |
parent | adding php.ini (diff) | |
download | ice-8fb38cf1e5f8db5e4285ae43a77b0ba432b51cc6.tar.bz2 ice-8fb38cf1e5f8db5e4285ae43a77b0ba432b51cc6.tar.xz ice-8fb38cf1e5f8db5e4285ae43a77b0ba432b51cc6.zip |
ICE-5749 - Replace Promise with Ice.Promise in demos
-rw-r--r-- | js/demo/ChatDemo/Client.js | 7 | ||||
-rw-r--r-- | js/demo/Glacier2/chat/browser/Client.js | 7 | ||||
-rw-r--r-- | js/demo/Ice/bidir/Client.js | 6 | ||||
-rw-r--r-- | js/demo/Ice/bidir/browser/Client.js | 15 | ||||
-rw-r--r-- | js/demo/Ice/latency/browser/Client.js | 20 |
5 files changed, 25 insertions, 30 deletions
diff --git a/js/demo/ChatDemo/Client.js b/js/demo/ChatDemo/Client.js index a982a52da32..9c83c071150 100644 --- a/js/demo/ChatDemo/Client.js +++ b/js/demo/ChatDemo/Client.js @@ -9,7 +9,6 @@ (function(){ -var Promise = Ice.Promise; var RouterPrx = Glacier2.RouterPrx; var ChatRoomCallbackPrx = Chat.ChatRoomCallbackPrx; var ChatSessionPrx = Chat.ChatSessionPrx; @@ -159,7 +158,7 @@ var run = function(router, session) // state. The completion could happen because the user signed out, // or because there is an exception. // - var chat = new Promise(); + var chat = new Ice.Promise(); // // Get the session timeout and the router client category, then // create the client object adapter. @@ -167,7 +166,7 @@ var run = function(router, session) // Use Ice.Promise.all to wait for the completion of all the // calls. // - Promise.all( + Ice.Promise.all( router.getSessionTimeout(), router.getCategoryForClient(), communicator.createObjectAdapterWithRouter("", router) @@ -416,7 +415,7 @@ function setState(newState, error) // First destroy the communicator if needed then do // the screen transition. // - return Promise.try( + return Ice.Promise.try( function() { if(communicator) diff --git a/js/demo/Glacier2/chat/browser/Client.js b/js/demo/Glacier2/chat/browser/Client.js index 7e316897669..1f905448325 100644 --- a/js/demo/Glacier2/chat/browser/Client.js +++ b/js/demo/Glacier2/chat/browser/Client.js @@ -9,7 +9,6 @@ (function(){ -var Promise = Ice.Promise; var RouterPrx = Glacier2.RouterPrx; var ChatSessionPrx = Demo.ChatSessionPrx; var ChatCallbackPrx = Demo.ChatCallbackPrx; @@ -43,7 +42,7 @@ var signin = function() { var communicator; var router; - Promise.try( + Ice.Promise.try( function() { state = State.Connecting; @@ -148,7 +147,7 @@ var run = function(communicator, router, session) // state. The completion could happen because the user signed out, // or because an exception was raised. // - var chat = new Promise(); + var chat = new Ice.Promise(); // // Get the session timeout and the router client category, and @@ -157,7 +156,7 @@ var run = function(communicator, router, session) // Use Ice.Promise.all to wait for the completion of all the // calls. // - Promise.all( + Ice.Promise.all( router.getSessionTimeout(), router.getCategoryForClient(), communicator.createObjectAdapterWithRouter("", router) diff --git a/js/demo/Ice/bidir/Client.js b/js/demo/Ice/bidir/Client.js index 6f71841bf26..7707809316f 100644 --- a/js/demo/Ice/bidir/Client.js +++ b/js/demo/Ice/bidir/Client.js @@ -51,7 +51,7 @@ Ice.Promise.try( // Initialize the communicator and create a proxy to the sender object. // var proxy = communicator.stringToProxy("sender:tcp -p 10000"); - + // // Down-cast the proxy to the Demo.CallbackSender interface. // @@ -69,7 +69,7 @@ Ice.Promise.try( // the object adapter. // var r = adapter.addWithUUID(new CallbackReceiverI()); - + // // Set the connection adapter. // @@ -86,7 +86,7 @@ Ice.Promise.try( function(ex) { console.log(ex.toString()); - Promise.try( + Ice.Promise.try( function() { if(communicator) diff --git a/js/demo/Ice/bidir/browser/Client.js b/js/demo/Ice/bidir/browser/Client.js index dd0b340d8d0..ca44be729be 100644 --- a/js/demo/Ice/bidir/browser/Client.js +++ b/js/demo/Ice/bidir/browser/Client.js @@ -9,7 +9,6 @@ (function(){ -var Promise = Ice.Promise; var CallbackSenderPrx = Demo.CallbackSenderPrx; // @@ -44,7 +43,7 @@ var start = function() // var hostname = document.location.hostname || "127.0.0.1"; var proxy = communicator.stringToProxy("sender:ws -p 10002 -h " + hostname); - + // // Down-cast the proxy to the Demo.CallbackSender interface. // @@ -62,13 +61,13 @@ var start = function() // the object adapter. // var r = adapter.addWithUUID(new CallbackReceiverI()); - + // // Set the connection adapter and remember the connection. // connection = proxy.ice_getCachedConnection(); connection.setAdapter(adapter); - + // // Register the client with the bidir server. // @@ -82,9 +81,9 @@ var stop = function() // // Close the connection, the server will unregister the client // when it tries to invoke on the bi-dir proxy. - // + // return connection.close(false); -} +}; // // Setup button click handlers @@ -95,7 +94,7 @@ $("#start").click( if(isDisconnected()) { setState(State.Connecting); - Promise.try( + Ice.Promise.try( function() { return start().then(function() @@ -120,7 +119,7 @@ $("#stop").click( if(isConnected()) { setState(State.Disconnecting); - Promise.try( + Ice.Promise.try( function() { return stop(); diff --git a/js/demo/Ice/latency/browser/Client.js b/js/demo/Ice/latency/browser/Client.js index 3a86f26c7ed..b8344cfbfeb 100644 --- a/js/demo/Ice/latency/browser/Client.js +++ b/js/demo/Ice/latency/browser/Client.js @@ -9,8 +9,6 @@ (function(){ -var Promise = Ice.Promise; - // // Initialize the communicator // @@ -26,13 +24,13 @@ function run() // var hostname = document.location.hostname || "127.0.0.1"; var secure = document.location.protocol.indexOf("https") != -1; - var ref = secure ? + var ref = secure ? "ping:wss -h " + hostname + " -p 9090 -r /demowss" : "ping:ws -h " + hostname + " -p 8080 -r /demows"; var proxy = communicator.stringToProxy(ref); - + var repetitions = 1000; - + // // Down-cast the proxy to the Demo.Ping interface. // @@ -42,7 +40,7 @@ function run() writeLine("pinging server " + repetitions + " times (this may take a while)"); start = new Date().getTime(); return loop( - function() + function() { return obj.ice_ping(); }, @@ -97,11 +95,11 @@ $("#run").click( // // Asynchronous loop: each call to the given function returns a // promise that when fulfilled runs the next iteration. -// +// function loop(fn, repetitions) { var i = 0; - var next = function() + var next = function() { if(i++ < repetitions) { @@ -123,9 +121,9 @@ function writeLine(msg) // // Handle the client state. // -var State = { - Idle:0, - Running: 1 +var State = { + Idle:0, + Running: 1 }; var state; |