# Event to know a \`turbo-stream\` has been rendered

**URL:** <https://discuss.hotwired.dev/t/event-to-know-a-turbo-stream-has-been-rendered/1554>\
**Category:** General\
**Created:** [December 23, 2020, 7:34am UTC](https://discuss.hotwired.dev/t/event-to-know-a-turbo-stream-has-been-rendered/1554 "2020-12-23T07:34:12Z")\
**Posts on this page:** 1\
**Showing post:** 25

<div class="post-metadata">

**Author:** ![sdhull](https://yyz1.discourse-cdn.com/flex027/user_avatar/discuss.hotwired.dev/sdhull/32/3442_2.png) [@sdhull](https://discuss.hotwired.dev/u/sdhull)\
**Post date:** [December 28, 2023, 3:07pm UTC](https://discuss.hotwired.dev/t/event-to-know-a-turbo-stream-has-been-rendered/1554/25 "2023-12-28T15:07:49Z")

</div>

For anyone else who stumbles on this and wishes for this event, you can actually create it yourself! This is what I’ve added to my `application.js`:

```auto
const afterRenderEvent = new Event("turbo:after-stream-render");
addEventListener("turbo:before-stream-render", (event) => {
  const originalRender = event.detail.render

  event.detail.render = function (streamElement) {
    originalRender(streamElement)
    document.dispatchEvent(afterRenderEvent);
  }
})

```

This introduces a `turbo:after-stream-render` event so you can re-init your 3rd party libraries after Turbo Stream renders. There’s probably some way to make it even better that I haven’t thought of / haven’t needed yet (eg, by firing it on a more appropriate target or maybe by attaching more data to the event). But for now this serves my needs 😄

Hope this helps someone else 🍻

---

_[View the full topic](https://discuss.hotwired.dev/t/event-to-know-a-turbo-stream-has-been-rendered/1554)._
