Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | |
|
binji
2016/02/24 19:23:08
2016, and remove (c)
| |
| 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. | |
| 7 function 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 function load_me() { | |
|
binji
2016/02/24 19:23:08
nit: loadMe (and unloadMe below)
| |
| 20 common.naclModule.postMessage('hello'); | |
| 21 | |
| 22 document.getElementById("load").disabled = true; | |
| 23 document.getElementById("unload").disabled = false; | |
| 24 } | |
| 25 function unload_me() { | |
| 26 common.naclModule.postMessage('bye'); | |
| 27 | |
| 28 document.getElementById("load").disabled = false; | |
| 29 document.getElementById("unload").disabled = true; | |
| 30 } | |
| 31 | |
| 32 // This function is called by common.js when a message is received from the | |
| 33 // NaCl module. | |
| 34 function handleMessage(message) { | |
| 35 var logEl = document.getElementById('log'); | |
| 36 logEl.textContent += message.data; | |
| 37 } | |
| OLD | NEW |