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

Unified Diff: native_client_sdk/src/examples/hello_world_interactive/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 side-by-side diff with in-line comments
Download patch
Index: native_client_sdk/src/examples/hello_world_interactive/example.js
diff --git a/native_client_sdk/src/examples/hello_world_interactive/example.js b/native_client_sdk/src/examples/hello_world_interactive/example.js
index 9e2a88f99b266ad6cecf46eaefb9ab7f8ca08119..7058f732f58b2e0503ef815731dd926c1bf14b83 100644
--- a/native_client_sdk/src/examples/hello_world_interactive/example.js
+++ b/native_client_sdk/src/examples/hello_world_interactive/example.js
@@ -25,7 +25,12 @@ function reverseText() {
common.naclModule.postMessage('reverseText:' + inputBox.value);
}
-// Called by the common.js module.
-function handleMessage(message_event) {
- alert(message_event.data);
+function handleMessage(e) {
+ if (typeof e.data === 'string') {
+ // Received a reversed message.
+ common.logMessage('Received "' + e.data + '"\n');
+ } else if (typeof e.data === 'number') {
+ // Recived 42.
+ common.logMessage('Received "' + e.data + '"\n');
+ }
}

Powered by Google App Engine
This is Rietveld 408576698