Re: [whatwg/fetch] Aborting a fetch (#27)

The solution is to better use timers and address them, same as you would address listeners or you won't be able to remove them later on.

The concept of an ID, nothing new to learn.

```js
function Fit() {
  // since you define at runtime functions
  function ololo() {
    console.log('ololo');
    return setTimeout(ololo, 1000);
  }
  // you can define at runtime methods too
  this.kill = function () {
    clearTimeout(interval);
  };
  // and invoke .kill() whenever you want
  var interval = ololo();
}

var fit = new Fit();
setTimeout(fit.kill, 500);
```

JS has been historically considered a toy probably because many developers stopped learning it, convinced they mastered it already, after reading just one book.

Moreover, the unaddressed timer issue has absolutely nothing to do with this problem which is the same in many other programming languages where promises cannot be canceled.

A timer, like a listener, can *always* be removed, if you keep the reference somehow.

Best Regards

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/whatwg/fetch/issues/27#issuecomment-252996528

Received on Tuesday, 11 October 2016 18:06:00 UTC