# Cancel Token on reader promise

**URL:** <https://discourse.vtk.org/t/cancel-token-on-reader-promise/8210>\
**Category:** Web\
**Created:** [April 4, 2022, 12:41pm UTC](https://discourse.vtk.org/t/cancel-token-on-reader-promise/8210 "2022-04-04T12:41:03Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![peeling](https://discourse.vtk.org/letter_avatar_proxy/v4/letter/p/b5e925/32.png) [@peeling](https://discourse.vtk.org/u/peeling)\
**Post date:** [April 4, 2022, 12:41pm UTC](https://discourse.vtk.org/t/cancel-token-on-reader-promise/8210/1 "2022-04-04T12:41:03Z")

</div>

Hey,

I need to know if we can cancel the reader promise of loading data, like we can do it in axios for example.

I want to use the `Debounce` functionnality to just execute the last loading data promise from a consecutif loading data promises, in order to do that I would need to know how we can cancel promises in vtk.js?

Thank you

---

<div class="post-metadata">

**Author:** ![Forrest](https://discourse.vtk.org/user_avatar/discourse.vtk.org/forrest/32/300_2.png) [@Forrest](https://discourse.vtk.org/u/Forrest)\
**Post date:** [April 4, 2022, 1:27pm UTC](https://discourse.vtk.org/t/cancel-token-on-reader-promise/8210/2 "2022-04-04T13:27:06Z")

</div>

There currently is no way to abort a fetch request. An `AbortController` would need to be added to the reader.

If you’re using `macro.debounce` from vtk.js, then it will wait X milliseconds from the last request before executing your method. If you’re using another debounce implementation (e.g. lodash), then you want to ensure that you execute on the trailing edge of the timeout. This sort of mimics your need to execute the last loading data promise within X milliseconds.
