So, I recently had a pretty weird problem when developing a library, safe_children.
When I was writing the examples, I decided to try making it like this:
var child = new Child('otherFile.js', 3 * 60);
child.loadScript()
.then(child.spawn);
This code doesn't work. this
points to something I couldn't find out. However, this piece of code works:
var child = new Child('otherFile.js', 3 * 60);
child.loadScript()
.then(function(){
child.spawn();
});
Anyone knows why? What is this
in this context? Thanks!