OLD | NEW |
1 #!mojo:js_content_handler | 1 #!mojo mojo:js_content_handler |
2 // Demonstrate using the ServiceProvider returned by the Shell | 2 // Demonstrate using the ServiceProvider returned by the Shell |
3 // connectToApplication() method to provide a service to the | 3 // connectToApplication() method to provide a service to the |
4 // target application and to request a service from the target | 4 // target application and to request a service from the target |
5 // application. To run this application with mojo_shell, set DIR | 5 // application. To run this application with mojo_shell, set DIR |
6 // to be the absolute path for this directory, then: | 6 // to be the absolute path for this directory, then: |
7 // mojo_shell "file://$DIR/share_echo.js file://$DIR/share_echo_target.js" | 7 // mojo_shell "file://$DIR/share_echo.js file://$DIR/share_echo_target.js" |
8 | 8 |
9 define("main", [ | 9 define("main", [ |
10 "console", | 10 "console", |
11 "mojo/services/public/js/application", | 11 "mojo/services/public/js/application", |
(...skipping 24 matching lines...) Expand all Loading... |
36 targetSP.provideService(EchoService, EchoServiceImpl); | 36 targetSP.provideService(EchoService, EchoServiceImpl); |
37 var echoService = targetSP.requestService(EchoService); | 37 var echoService = targetSP.requestService(EchoService); |
38 echoService.echoString("ShareEcho").then(function(response) { | 38 echoService.echoString("ShareEcho").then(function(response) { |
39 console.log(response.value); | 39 console.log(response.value); |
40 }); | 40 }); |
41 } | 41 } |
42 } | 42 } |
43 | 43 |
44 return ShareEcho; | 44 return ShareEcho; |
45 }); | 45 }); |
OLD | NEW |