Created
May 5, 2015 15:39
-
-
Save simov/eff7e508bd16ee5eeab4 to your computer and use it in GitHub Desktop.
Modifying the global state
This file contains 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
var file1 = require('./file1') | |
var file2 = require('./file2') |
This file contains 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
var request = require('request') | |
setTimeout(function () { | |
request.on('error', function (err) { | |
console.log('file1 call1 global on', err) | |
}).get('badurl') | |
}, 500) | |
setTimeout(function () { | |
request.on('error', function (err) { | |
console.log('file1 call2 global on', err) | |
}).get('badurl') | |
}, 3000) |
This file contains 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
var request = require('request') | |
setTimeout(function () { | |
request.get('badurl') | |
}, 1000) | |
setTimeout(function () { | |
request.get('badurl').on('error', function (err) { | |
console.log('file2 call2 ... on', err) | |
}) | |
}, 1000) | |
setTimeout(function () { | |
request.on('error', function (err) { | |
console.log('file2 call2 global on', err) | |
}).get('badurl') | |
}, 2000) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment