Created
January 28, 2016 06:43
-
-
Save focusaurus/bff56d373fdea0d2eca1 to your computer and use it in GitHub Desktop.
iron-node and babel step through
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Show hidden characters
{ | |
"presets": ["es2015", "stage-0"], | |
"plugins": [ | |
"transform-decorators-legacy", | |
"transform-export-extensions" | |
] | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"author": "Peter Lyons <[email protected]> (http://peterlyons.com/)", | |
"license": "MIT", | |
"name": "SET_NAME_HERE", | |
"private": true, | |
"version": "1.0.0", | |
"dependencies": { | |
"babel-core": "6.4.5", | |
"babel-plugin-transform-decorators-legacy": "1.3.4", | |
"babel-plugin-transform-export-extensions": "6.4.0", | |
"babel-plugin-transform-regenerator": "6.4.4", | |
"babel-polyfill": "6.3.14", | |
"babel-preset-es2015": "6.3.13", | |
"babel-preset-stage-0": "6.3.13", | |
"babel-register": "6.4.3", | |
"babel-runtime": "6.3.19", | |
"iron-node": "2.1.13" | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import http from 'http' | |
export async function load (url) { | |
return new Promise(function (resolve, reject) { | |
http.get(url, function (res) { | |
var chunks = [] | |
res.on('data', chunk => chunks.push(chunk.toString())) | |
res.on('end', () => resolve(chunks.join())) | |
}) | |
}) | |
} | |
async function main() { | |
console.log('Put a dynamic breakpoint on this line') | |
// I cannot find a combination of "Step Over" or in/out | |
// that will get me to the line after the await | |
const html = await load('http://www.google.com') | |
console.log(html) | |
console.log("you cannot step to this line") | |
console.log("once you've hit an 'await', can't step through") | |
} | |
// You seem to need to always have an initial debugger statement somewher | |
debugger; | |
main() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require("babel-register") | |
require('babel-polyfill') | |
require('./stage0') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment