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

Side by Side Diff: native_client_sdk/src/examples/dlopen/example.js

Issue 13488007: [NaCl SDK] Make the SDK examples buildable as a packaged app. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix license headers Created 7 years, 8 months 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 // Called by the common.js module. 5 // Called by the common.js module.
6 function attachListeners() { 6 function attachListeners() {
7 document.querySelector('form').addEventListener('submit', askBall); 7 document.querySelector('form').addEventListener('submit', askBall);
8 document.getElementById('reverse').addEventListener('click', reverseString); 8 document.getElementById('reverse').addEventListener('click', reverseString);
9 } 9 }
10 10
11 // Called by the common.js module. 11 // Called by the common.js module.
12 function moduleDidLoad() { 12 function moduleDidLoad() {
13 // The module is not hidden by default so we can easily see if the plugin 13 // The module is not hidden by default so we can easily see if the plugin
14 // failed to load. 14 // failed to load.
15 common.hideModule(); 15 common.hideModule();
16 } 16 }
17 17
18 function askBall(event) { 18 function askBall(event) {
19 var questionEl = document.getElementById('question'); 19 var questionEl = document.getElementById('question');
20 var query = questionEl.value; 20 var query = questionEl.value;
21 questionEl.value = ''; 21 questionEl.value = '';
22 document.getElementById('log').innerHTML += 'You asked:' + query + '<br>'; 22 common.logMessage('You asked: ' + query + '\n');
23 common.naclModule.postMessage('eightball'); 23 common.naclModule.postMessage('eightball');
24 event.preventDefault(); 24 event.preventDefault();
25 } 25 }
26 26
27 function reverseString(event) { 27 function reverseString(event) {
28 var questionEl = document.getElementById('question'); 28 var questionEl = document.getElementById('question');
29 var query = questionEl.value; 29 var query = questionEl.value;
30 questionEl.value = ''; 30 questionEl.value = '';
31 31 common.logMessage('Reversing: ' + query + '\n');
32 document.getElementById('log').innerHTML += 'Reversing:' + query + '<br>';
33 common.naclModule.postMessage('reverse:' + query); 32 common.naclModule.postMessage('reverse:' + query);
34 } 33 }
OLDNEW
« no previous file with comments | « native_client_sdk/src/examples/dlopen/example.dsc ('k') | native_client_sdk/src/examples/dlopen/index.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698