| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 var kMaxArraySize = 20; | |
| 6 var messageArray = new Array(); | |
| 7 | |
| 8 // Once we load, hide the plugin | 5 // Once we load, hide the plugin |
| 9 function moduleDidLoad() { | 6 function moduleDidLoad() { |
| 10 common.hideModule(); | 7 common.hideModule(); |
| 11 } | 8 } |
| 12 | 9 |
| 13 // Called by the common.js module. | 10 // Called by the common.js module. |
| 14 function handleMessage(message) { | 11 function handleMessage(message) { |
| 15 // Show last |kMaxArraySize| events in html. | 12 common.logMessage(message.data); |
| 16 messageArray.push(message.data); | |
| 17 if (messageArray.length > kMaxArraySize) { | |
| 18 messageArray.shift(); | |
| 19 } | |
| 20 var newData = messageArray.join('<BR>'); | |
| 21 document.getElementById('outputString').innerHTML = newData; | |
| 22 // Print event to console. | |
| 23 console.log(message.data); | |
| 24 } | 13 } |
| OLD | NEW |