| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 // This trivial app just loads "cnn.com" using the Mojo Network and URLLoader | 5 // This trivial app just loads "cnn.com" using the Mojo Network and URLLoader |
| 6 // services and then prints a brief summary of the response. | 6 // services and then prints a brief summary of the response. |
| 7 // | 7 // |
| 8 // To run it this file must be specified as a URL. For | 8 // To run it this file must be specified as a URL. For |
| 9 // example: | 9 // example: |
| 10 // (cd YOUR_DIR/mojo/apps/js; python -m SimpleHTTPServer ) & | 10 // (cd YOUR_DIR/mojo/apps/js; python -m SimpleHTTPServer ) & |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 43 for(var key in result.response) | 43 for(var key in result.response) |
| 44 console.log(key + " => " + result.response[key]); | 44 console.log(key + " => " + result.response[key]); |
| 45 var drainDataPromise = core.drainData(result.response.body); | 45 var drainDataPromise = core.drainData(result.response.body); |
| 46 drainDataPromise.then(function(result) { | 46 drainDataPromise.then(function(result) { |
| 47 console.log("read " + result.buffer.byteLength + " bytes"); | 47 console.log("read " + result.buffer.byteLength + " bytes"); |
| 48 }).then(function() { | 48 }).then(function() { |
| 49 mojo.quit(); | 49 mojo.quit(); |
| 50 }); | 50 }); |
| 51 }); | 51 }); |
| 52 }); | 52 }); |
| OLD | NEW |