Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 var nacl = nacl || {}; | |
|
James Hawkins
2012/08/11 19:21:07
This is still dangerous in that these methods may
jvoung (off chromium)
2012/08/13 22:15:43
Sorry a bit of a JS noob, so may be doing it wrong
| |
| 2 | |
| 3 /** | |
| 4 * Takes the |moduleListData| input argument which represents data about | |
| 5 * the currently available modules and populates the html jstemplate | |
| 6 * with that data. It expects an object structure like the above. | |
| 7 * @param {Object} moduleListData Information about available modules | |
| 8 */ | |
| 9 nacl.renderTemplate = function(moduleListData) { | |
| 10 // Process the template. | |
| 11 var input = new JsEvalContext(moduleListData); | |
| 12 var output = $('naclInfoTemplate'); | |
| 13 jstProcess(input, output); | |
| 14 }; | |
| 15 | |
| 16 /** | |
| 17 * Asks the C++ NaClUIDOMHandler to get details about the NaCl and return | |
| 18 * the data in returnNaClInfo() (below). | |
| 19 */ | |
| 20 nacl.requestNaClInfo = function() { | |
| 21 chrome.send('requestNaClInfo'); | |
| 22 }; | |
| 23 | |
| 24 /** | |
| 25 * Called by the WebUI to re-populate the page with data representing the | |
| 26 * current state of NaCl. | |
| 27 * @param {Object} moduleListData Information about available modules | |
| 28 */ | |
| 29 nacl.returnNaClInfo = function(moduleListData) { | |
| 30 $('loading-message').hidden = 'hidden'; | |
| 31 $('body-container').hidden = ''; | |
| 32 nacl.renderTemplate(moduleListData); | |
| 33 }; | |
| 34 | |
| 35 // Get data and have it displayed upon loading. | |
| 36 document.addEventListener('DOMContentLoaded', nacl.requestNaClInfo); | |
| OLD | NEW |