Created
November 10, 2017 13:31
-
-
Save Jabher/3994844ad6f2bc13689b7057b61c710e to your computer and use it in GitHub Desktop.
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('./magic'); | |
function a() { | |
console.log(global.env.test) | |
} | |
Promise.resolve() | |
.then(async function () { | |
global.env.test = 'baz'; | |
console.log('in async 1', global.env.test); | |
await new Promise(res => process.nextTick(res)); | |
// console.log('in async 2', global.env.test); | |
await new Promise(res => process.nextTick(res)); | |
// console.log('in async 3', global.env.test); | |
await new Promise(res => process.nextTick(res)); | |
a(); | |
}); | |
Promise.resolve() | |
.then(() => { | |
process.nextTick(() => { | |
global.env.test = 'foo'; | |
console.log('in nextTick 1', global.env.test); | |
process.nextTick(() => { | |
global.env.test = 'bar'; | |
// Reflect.getPrototypeOf(global.env.test).test2 = 'baz'; | |
console.log('in nextTick 1-1', global.env.test); | |
}); | |
process.nextTick(() => { | |
console.log('in nextTick 1-2', global.env.test); | |
}); | |
}); | |
process.nextTick(() => { | |
console.log('in nextTick 2', global.env.test); | |
process.nextTick(() => { | |
console.log('in nextTick 2-2', global.env.test); | |
}) | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment