Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(257)

Side by Side Diff: examples/js/hello.js

Issue 757703002: Creates a JavaScript Applicaiton (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: Do not try to call undefined Application methods. Created 6 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(Empty)
1 #!mojo:js_content_handler
2 // Demonstrate one JS Mojo application connecting to another to emit "hello
3 // world". To run this application with mojo_shell, set DIR to be the absolute
4 // path for this directory, then:
5 // mojo_shell "file://$DIR/hello.js file://$DIR/world.js"
6 // Launches the Mojo hello.js application which connects to the application
7 // URL specified as a Mojo application argument, world.js in this case.
8
9 define("main", [
10 "console",
11 "mojo/public/interfaces/application/service_provider.mojom",
12 ], function(console, sp) {
13
14 function Application(shell, url) {
15 this.shell = shell;
16 console.log(url + ": Hello");
17 }
18
19 Application.prototype.initialize = function(args) {
20 if (args.length != 2) {
21 console.log("Expected hello.js URL argument");
22 return;
23 }
24 var serviceProvider = new sp.ServiceProvider.proxyClass();
25 // TODO(hansmuller): the following step shouldn't be necessary.
26 var handle = serviceProvider.getConnection$().messagePipeHandle;
27 this.shell.connectToApplication(args[1], handle);
28 }
29
30 Application.prototype.acceptConnection = function(url, serviceProvider) {
31 }
32
33 return Application;
34 });
OLDNEW
« no previous file with comments | « examples/js/README.md ('k') | examples/js/main.js » ('j') | gin/modules/module_registry.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698