From 707a3fada4a14648029382cd0251347a7d94ccc3 Mon Sep 17 00:00:00 2001 From: afcapel Date: Tue, 16 Jan 2024 13:22:21 +0000 Subject: [PATCH] deploy: b2573772f7b2d7c07199581ed030a39370e0777c --- handbook/streams.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/handbook/streams.html b/handbook/streams.html index 46553a5..484a47b 100644 --- a/handbook/streams.html +++ b/handbook/streams.html @@ -177,7 +177,7 @@

But What About Running JavaScript?

Turbo Streams consciously restricts you to seven actions: append, prepend, (insert) before, (insert) after, replace, update, and remove. If you want to trigger additional behavior when these actions are carried out, you should attach behavior using Stimulus controllers. This restriction allows Turbo Streams to focus on the essential task of delivering HTML over the wire, leaving additional logic to live in dedicated JavaScript files.

-

Embracing these constraints will keep you from turning individual responses in a jumble of behaviors that cannot be reused and which make the app hard to follow. The key benefit from Turbo Streams is the ability to reuse templates for initial rendering of a page through all subsequent updates.

+

Embracing these constraints will keep you from turning individual responses into a jumble of behaviors that cannot be reused and which make the app hard to follow. The key benefit from Turbo Streams is the ability to reuse templates for initial rendering of a page through all subsequent updates.

Custom Actions

By default, Turbo Streams support seven values for its action attribute. If your application needs to support other behaviors, you can override the event.detail.render function.

For example, if you’d like to expand upon the seven actions to support <turbo-stream> elements with [action="alert"] or [action="log"], you could declare a turbo:before-stream-render listener to provide custom behavior: