1// Copyright (c) 2013 The Chromium Authors. All rights reserved.
2// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
5// This function is called by common.js when the NaCl module is
6// loaded.
7function moduleDidLoad() {
8  // Once we load, hide the plugin. In this example, we don't display anything
9  // in the plugin, so it is fine to hide it.
10  common.hideModule();
11
12  // After the NaCl module has loaded, common.naclModule is a reference to the
13  // NaCl module's <embed> element.
14  //
15  // postMessage sends a message to it.
16  common.naclModule.postMessage('hello');
17}
18
19// This function is called by common.js when a message is received from the
20// NaCl module.
21function handleMessage(message) {
22  var logEl = document.getElementById('log');
23  logEl.textContent += message.data;
24}
25