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

Unified Diff: native_client_sdk/src/examples/load_progress/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/load_progress/example.js
diff --git a/native_client_sdk/src/examples/load_progress/example.js b/native_client_sdk/src/examples/load_progress/example.js
index 37c307950004d717c14dc4ee73d0a06d01b4cf54..8e7c00dfdd169c84e86752b5216d3ab65af4f9e3 100644
--- a/native_client_sdk/src/examples/load_progress/example.js
+++ b/native_client_sdk/src/examples/load_progress/example.js
@@ -20,7 +20,7 @@ function domContentLoaded(name, tc, config, width, height) {
// event is always triggered when an <EMBED> tag has a MIME type of
// application/x-nacl.
function moduleDidStartLoad() {
- appendToEventLog('loadstart');
+ common.logMessage('loadstart\n');
}
// Progress event handler. |event| contains a couple of interesting
@@ -44,8 +44,8 @@ function moduleLoadProgress(event) {
loadPercent = -1.0;
loadPercentString = 'Computing...';
}
- appendToEventLog('progress: ' + loadPercentString +
- ' (' + event.loaded + ' of ' + event.total + ' bytes)');
+ common.logMessage('progress: ' + loadPercentString +
+ ' (' + event.loaded + ' of ' + event.total + ' bytes)\n');
}
// Handler that gets called if an error occurred while loading the NaCl
@@ -53,17 +53,17 @@ function moduleLoadProgress(event) {
// the error, you have to check lastError on the <EMBED> element to find
// out what happened.
function moduleLoadError() {
- appendToEventLog('error: ' + common.naclModule.lastError);
+ common.logMessage('error: ' + common.naclModule.lastError + '\n');
}
// Handler that gets called if the NaCl module load is aborted.
function moduleLoadAbort() {
- appendToEventLog('abort');
+ common.logMessage('abort\n');
}
// When the NaCl module has loaded indicate success.
function moduleDidLoad() {
- appendToEventLog('load');
+ common.logMessage('load\n');
common.updateStatus('SUCCESS');
}
@@ -74,27 +74,15 @@ function moduleDidLoad() {
// that if the NaCl module loads successfully, you will get both a 'load'
// event and a 'loadend' event.
function moduleDidEndLoad() {
- appendToEventLog('loadend');
+ common.logMessage('loadend\n');
var lastError = event.target.lastError;
if (lastError == undefined || lastError.length == 0) {
- lastError = '&lt;none&gt;';
+ lastError = '<none>';
}
- appendToEventLog('lastError: ' + lastError);
+ common.logMessage('lastError: ' + lastError + '\n');
}
// Handle a message coming from the NaCl module.
function handleMessage(message_event) {
- alert(message_event.data);
-}
-
-// Append an event name to the 'log' element. Event names
-// are separated by a <br> tag so they get listed one per line.
-// logMessage The message to append to the log.
-function appendToEventLog(logMessage) {
- var eventLogField = document.getElementById('log');
- if (eventLogField.innerHTML.length == 0) {
- eventLogField.innerHTML = logMessage;
- } else {
- eventLogField.innerHTML = eventLogField.innerHTML + '<br>' + logMessage;
- }
+ common.logMessage('Received PostMessage: ' + message_event.data + '\n');
}
« no previous file with comments | « native_client_sdk/src/examples/load_progress/example.dsc ('k') | native_client_sdk/src/examples/load_progress/index.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698