| Index: native_client_sdk/src/examples/trace_events/example.js
|
| diff --git a/native_client_sdk/src/examples/trace_events/example.js b/native_client_sdk/src/examples/trace_events/example.js
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..6e652e8752b58de3bedcf46573a4a05d96cfc639
|
| --- /dev/null
|
| +++ b/native_client_sdk/src/examples/trace_events/example.js
|
| @@ -0,0 +1,37 @@
|
| +// Copyright (c) 2013 The Chromium Authors. All rights reserved.
|
| +// Use of this source code is governed by a BSD-style license that can be
|
| +// found in the LICENSE file.
|
| +
|
| +// Called by the common.js module.
|
| +function moduleDidLoad() {
|
| + // The module is not hidden by default so we can easily see if the plugin
|
| + // failed to load.
|
| + common.hideModule();
|
| +}
|
| +
|
| +// Called by the common.js module.
|
| +function attachListeners() {
|
| + document.getElementById('runthreadedtask').addEventListener('click',
|
| + runthreadedtask);
|
| + document.getElementById('sendasynctrace').addEventListener('click',
|
| + sendasynctrace);
|
| +}
|
| +
|
| +function runthreadedtask() {
|
| + common.naclModule.postMessage('runthreadedtask');
|
| +}
|
| +
|
| +function sendasynctrace() {
|
| + var async_button = document.getElementById('sendasynctrace');
|
| + if (async_button.value == 'Send async trace begin') {
|
| + common.naclModule.postMessage('sendasyncbegin');
|
| + async_button.value = 'Send async trace end';
|
| + } else {
|
| + common.naclModule.postMessage('sendasyncend');
|
| + async_button.value = 'Send async trace begin';
|
| + }
|
| +}
|
| +
|
| +// Called by the common.js module.
|
| +function handleMessage(message_event) {
|
| +}
|
|
|