# Tip: show spinner only when something is slow

**URL:** <https://discourse.aurelia.io/t/tip-show-spinner-only-when-something-is-slow/967>\
**Category:** Framework Knowledge\
**Created:** [March 25, 2018, 4:56am UTC](https://discourse.aurelia.io/t/tip-show-spinner-only-when-something-is-slow/967 "2018-03-25T04:56:49Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![huochunpeng](https://avatars.discourse-cdn.com/v4/letter/h/49beb7/32.png) [@huochunpeng](https://discourse.aurelia.io/u/huochunpeng)\
**Post date:** [March 25, 2018, 4:56am UTC](https://discourse.aurelia.io/t/tip-show-spinner-only-when-something-is-slow/967/1 "2018-03-25T04:56:49Z")

</div>

# Show spinner only when something is slow

First make sure upgrade all your packages, you need running with `aurelia-templating-resources` latest version `1.6.0` or above.

The latest version contains an important bug fix for debounce.

Yes, debounce. It’s so obvious once pointed out, isn’t it?

```html
<my-spinner if.bind="router.isNavigating & debounce"></my-spinner>

```

```html
<loading-indicator
  loading.bind="router.isNavigating || api.isRequesting & debounce:500"
></loading-indicator>

```

> Note: debounce, does not only remove spikes, delay appearance of spinner, but also delay disappearance of spinner. Too big delay is probably not what you want.

The take away is, throttle and debounce are mathematical functions that can manipulate time. It is a stereotype to only use them on input and event.

---

<div class="post-metadata">

**Author:** ![Alexander-Taran](https://yyz1.discourse-cdn.com/flex027/user_avatar/discourse.aurelia.io/alexander-taran/32/2308_2.png) [@Alexander-Taran](https://discourse.aurelia.io/u/Alexander-Taran)\
**Post date:** [March 25, 2018, 10:23am UTC](https://discourse.aurelia.io/t/tip-show-spinner-only-when-something-is-slow/967/2 "2018-03-25T10:23:20Z")

</div>

Awesome  
Can I steal it for contrib recipes?

---

<div class="post-metadata">

**Author:** ![huochunpeng](https://avatars.discourse-cdn.com/v4/letter/h/49beb7/32.png) [@huochunpeng](https://discourse.aurelia.io/u/huochunpeng)\
**Post date:** [March 25, 2018, 11:12am UTC](https://discourse.aurelia.io/t/tip-show-spinner-only-when-something-is-slow/967/3 "2018-03-25T11:12:00Z")

</div>

Sure, I was thinking it’s too trivial for a guide.
