OLD | NEW |
1 #!mojo:js_content_handler | 1 #!mojo mojo:js_content_handler |
2 | 2 |
3 define("main", [ | 3 define("main", [ |
4 "mojo/services/public/js/application", | 4 "mojo/services/public/js/application", |
5 "services/js/test/echo_service.mojom" | 5 "services/js/test/echo_service.mojom" |
6 ], function(application, echoServiceMojom) { | 6 ], function(application, echoServiceMojom) { |
7 | 7 |
8 const Application = application.Application; | 8 const Application = application.Application; |
9 const EchoService = echoServiceMojom.EchoService; | 9 const EchoService = echoServiceMojom.EchoService; |
10 | 10 |
11 class Echo extends Application { | 11 class Echo extends Application { |
12 acceptConnection(url, serviceProvider) { | 12 acceptConnection(url, serviceProvider) { |
13 var app = this; | 13 var app = this; |
14 function EchoServiceImpl(client) { | 14 function EchoServiceImpl(client) { |
15 this.echoString = function(s) { | 15 this.echoString = function(s) { |
16 if (s == "quit") | 16 if (s == "quit") |
17 app.quit(); | 17 app.quit(); |
18 return Promise.resolve({value: s}); | 18 return Promise.resolve({value: s}); |
19 }; | 19 }; |
20 } | 20 } |
21 serviceProvider.provideService(EchoService, EchoServiceImpl); | 21 serviceProvider.provideService(EchoService, EchoServiceImpl); |
22 } | 22 } |
23 } | 23 } |
24 | 24 |
25 return Echo; | 25 return Echo; |
26 }); | 26 }); |
OLD | NEW |