OLD | NEW |
---|---|
1 .. _message-system: | 1 .. _message-system: |
2 | 2 |
3 ################ | 3 ################ |
4 Messaging System | 4 Messaging System |
5 ################ | 5 ################ |
6 | 6 |
7 .. contents:: | 7 .. contents:: |
8 :local: | 8 :local: |
9 :backlinks: none | 9 :backlinks: none |
10 :depth: 2 | 10 :depth: 2 |
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
138 | 138 |
139 // This function is called by common.js when a message is received from the | 139 // This function is called by common.js when a message is received from the |
140 // NaCl module. | 140 // NaCl module. |
141 function handleMessage(message) { | 141 function handleMessage(message) { |
142 // In the example, we simply log the data that's received in the message. | 142 // In the example, we simply log the data that's received in the message. |
143 var logEl = document.getElementById('log'); | 143 var logEl = document.getElementById('log'); |
144 logEl.textContent += message.data; | 144 logEl.textContent += message.data; |
145 } | 145 } |
146 | 146 |
147 // In the index.html we have set up the appropriate divs: | 147 // In the index.html we have set up the appropriate divs: |
148 <body {{attrs}}> | 148 <body {attrs}> |
Sam Clegg
2013/10/02 19:09:12
Devsite can't handle {{ or }} even within <pre> ta
|
eliben
2013/10/02 19:39:25
I think it's because these are template tags and t
|
149 <!-- ... --> | 149 <!-- ... --> |
150 <div id="listener"></div> | 150 <div id="listener"></div> |
151 <div id="log"></div> | 151 <div id="log"></div> |
152 </body> | 152 </body> |
153 | 153 |
154 | 154 |
155 Step 3: From example.js | 155 Step 3: From example.js |
156 ^^^^^^^^^^^^^^^^^^^^^^^ | 156 ^^^^^^^^^^^^^^^^^^^^^^^ |
157 | 157 |
158 .. naclcode:: | 158 .. naclcode:: |
(...skipping 247 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
406 virtual void HandleMessage(const pp::Var& var) { | 406 virtual void HandleMessage(const pp::Var& var) { |
407 if (var.is_dictionary()) { | 407 if (var.is_dictionary()) { |
408 pp::VarDictionary dictionary(var); | 408 pp::VarDictionary dictionary(var); |
409 // Use the dictionary | 409 // Use the dictionary |
410 pp::VarArray keys = dictionary.GetKeys(); | 410 pp::VarArray keys = dictionary.GetKeys(); |
411 // ... | 411 // ... |
412 } else { | 412 } else { |
413 // ... | 413 // ... |
414 } | 414 } |
415 } | 415 } |
OLD | NEW |