You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
It appears as though the line setTimeout(rollingSpider.land, 5000); fails with an undefined error because setTimeout is setting this to the global scope. I'd be willing to contribute a fix if it's not being worked on. (Solution here)
// WORKS
setTimeout(function() { rollingSpider.land(); }, 5000);
// BREAKS
setTimeout(rollingSpider.land, 5000);
...
/Users/rafy/Developer/drone-js-1/node_modules/rolling-spider/lib/drone.js:584
this.logger('RollingSpider#land');
^
TypeError: this.logger is not a function
at Timeout.land [as _onTimeout] (/Users/rafy/Developer/drone-js-1/node_modules/rolling-spider/lib/drone.js:584:8)
at ontimeout (timers.js:365:14)
at tryOnTimeout (timers.js:237:5)
at Timer.listOnTimeout (timers.js:207:5)
The text was updated successfully, but these errors were encountered:
I can't actually find this code anywhere in the project 0_o
The land() method of a RollingSpider instance is this sensitive and cannot be called as a an argument to setTimeout without having its context explicitly bound. Two solutions, which require no library code or example program changes:
@rwaldron I ended up using the first pattern back when I opened this issue. I wanted to reuse the reference to land, so the first was definitely easier. I took a stab at changing the library so I wouldn't have to bind every function I wanted to use. When I'm at my personal computer again, I can try and dig it up, dust it off and send a PR :)
It appears as though the line
setTimeout(rollingSpider.land, 5000);
fails with an undefined error becausesetTimeout
is settingthis
to the global scope. I'd be willing to contribute a fix if it's not being worked on. (Solution here)The text was updated successfully, but these errors were encountered: