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

Side by Side Diff: examples/js/README.md

Issue 788863003: Restore the JS Spinning Cube demo (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: Removed spurious includes 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
« no previous file with comments | « no previous file | examples/js/cube.js » ('j') | examples/js/cube.js » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 JavaScript Mojo Example Applications 1 JavaScript Mojo Example Applications
2 ===================== 2 =====================
3 3
4 hello.js, world.js - A minimal application that connects to another. 4 hello.js, world.js - A minimal application that connects to another.
5 5
6 wget.js - Uses the network service to load a URL. 6 wget.js - Uses the network service to load a URL.
7 7
8 cube.js - A JS version of examples/sample_app.
Aaron Boodman 2014/12/09 20:24:53 cool :)
8 9
9 --- Running Mojo Applications --- 10 --- Running Mojo Applications ---
10 11
11 A Mojo application written in JavaScript is launched with mojo_shell like this: 12 A Mojo application written in JavaScript is launched with mojo_shell like this:
12 13
13 mojo_shell <js-application-url> 14 mojo_shell <js-application-url>
14 15
15 Where js-application-url is either a file or an http URL that names a JS source 16 Where js-application-url is either a file or an http URL that names a JS source
Aaron Boodman 2014/12/09 20:24:53 Nit: it can be any URL that mojo shell understands
hansmuller 2014/12/09 20:43:21 I left the bit about using a file or http URL in a
16 file. The JS file itself must begin with a Mojo "shebang" that specifies the 17 file. The JS file itself must begin with a Mojo "shebang" that specifies the
17 Mojo URL of the JS content handler. In other words, the first line of the JS 18 Mojo URL of the JS content handler. In other words, the first line of the JS
18 source file must be: 19 source file must be:
19 20
20 #!mojo:js_content_handler 21 #!mojo:js_content_handler
21 22
22 Following the shebang should be a single AMD module called "main" whose value 23 Following the shebang should be a single AMD module called "main" whose value
23 is an Application subclass. The JS content handler will create an instance of 24 is an Application subclass. The JS content handler will create an instance of
24 the Application and make it the client of the Mojo shell. The JS content handler 25 the Application and make it the client of the Mojo shell. The JS content handler
25 is itself a Mojo application and it's responsible for creating an instance of V8 26 is itself a Mojo application and it's responsible for creating an instance of V8
(...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after
188 response parameter. In the EchoString case that would be something like 189 response parameter. In the EchoString case that would be something like
189 {value: "foo"}. 190 {value: "foo"}.
190 191
191 Similarly, the implementation of a Mojo interface functions that specify a 192 Similarly, the implementation of a Mojo interface functions that specify a
192 response, must return a Promise. The implementation of EchoString() could 193 response, must return a Promise. The implementation of EchoString() could
193 be written like this: 194 be written like this:
194 195
195 MyEchoStringImpl.prototype.EchoString = function(s) { 196 MyEchoStringImpl.prototype.EchoString = function(s) {
196 return Promise.resolve({value: s}); 197 return Promise.resolve({value: s});
197 }; 198 };
OLDNEW
« no previous file with comments | « no previous file | examples/js/cube.js » ('j') | examples/js/cube.js » ('J')

Powered by Google App Engine
This is Rietveld 408576698