OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 define([ | 5 define([ |
6 "console", | 6 "console", |
7 "mojo/apps/js/bootstrap", | 7 "mojo/apps/js/threading", |
8 "mojo/public/bindings/js/connector", | 8 "mojo/public/bindings/js/connector", |
9 "mojom/hello_world_service", | 9 "mojom/hello_world_service", |
10 ], function(console, bootstrap, connector, hello) { | 10 ], function(console, threading, connector, hello) { |
11 | 11 |
12 function HelloWorldClientImpl() { | 12 function HelloWorldClientImpl() { |
13 } | 13 } |
14 | 14 |
15 HelloWorldClientImpl.prototype = | 15 HelloWorldClientImpl.prototype = |
16 Object.create(hello.HelloWorldClientStub.prototype); | 16 Object.create(hello.HelloWorldClientStub.prototype); |
17 | 17 |
18 HelloWorldClientImpl.prototype.didReceiveGreeting = function(result) { | 18 HelloWorldClientImpl.prototype.didReceiveGreeting = function(result) { |
19 console.log("DidReceiveGreeting from pipe: " + result); | 19 console.log("DidReceiveGreeting from pipe: " + result); |
20 connection.close(); | 20 connection.close(); |
21 bootstrap.quit(); | 21 threading.quit(); |
22 }; | 22 }; |
23 | 23 |
24 var connection = new connector.Connection(bootstrap.initialHandle, | 24 var connection = null; |
25 HelloWorldClientImpl, | |
26 hello.HelloWorldServiceProxy); | |
27 | 25 |
28 connection.remote.greeting("hello, world!"); | 26 return function(handle) { |
| 27 connection = new connector.Connection(handle, |
| 28 HelloWorldClientImpl, |
| 29 hello.HelloWorldServiceProxy); |
| 30 |
| 31 connection.remote.greeting("hello, world!"); |
| 32 }; |
29 }); | 33 }); |
OLD | NEW |