Comments (2)
@crobbo It's not clear how you might be using this example, but there seems to be a misunderstanding on what stimulus does and doesn't do. Stimulus does use the MutationObserver API in a very simple way. It sets up to listen for element attributes, childlists Element Nodes and subtrees of the childlists for the "this" controller, so it does a deep search. However Stimulus only considers the attributes that are in the API as what is monitored for changes, that is actions, targets, classes, values and outlets.
As for Turbo turbo-frames or turbo-streams, there is no MutationObserver, But I guess that indirectly, but setting up a data-controller inline on the "turbo-xxxx" element, you can use the "this" for the turbo-stream for turbo-frame, perhaps pausing rendering by hooking into the events, and do something specific, then resume the rendering.
Turbo Streams are simple and elegant and just use the browser's API (since it is merely a subclass of an HTMLElement), so it uses the native browser callbacks and functions to implement the changes to the DOM. Turbo Frames are a little more advanced, because Turbo intercepts links and has to match the frames so a lot more is going on. Turbo Streams via Channels is more sophisticated but in essence uses WebSockets for channels along with a Redis connection, but if Turbo Streams is not via a channel, I believe that it simply uses a regular HTTP connection.
The Hotwire Turbo forum is a good place for questions like these. https://discuss.hotwired.dev/
from stimulus-rails.
Ok, thanks. Please close the issue as it's been a while since I was working on this and had this issue, as you say it was probably more to do with my lack of understanding at the time.
from stimulus-rails.
Related Issues (20)
- Controllers written in Coffeescript? HOT 1
- why not auto "rails stimulus:manifest:update"
- Failing to register controllers does not bubble the error to handleError HOT 1
- stimulus-rails installation rails - undefined method Stimulus::Rails.application HOT 1
- manifest:update configuration for controller segmentation HOT 1
- Should controller names be registered as camelCase? HOT 2
- rails stimulus:manifest:update replacing our index.js configs HOT 1
- 404 on assets/stimulus-loading.js with config.assets.digest set to false HOT 11
- Browser Back button is not working for some feature in stimulus HOT 2
- Console error with lazyLoadControllersFrom and external controller HOT 1
- Add typescript support for rails stimulus generator
- Action params not populating HOT 1
- Debugging `Failed to auto-load controller` ... `Unable to resolve specifier` HOT 2
- Error when passing JSON formatted data from rails to stimulus HOT 1
- Stimulus broken in Firefox 115+ with importmap-rails HOT 4
- Is it possible to use controllers stored in a GEM ?
- ActiveModel not working with value to Object HOT 2
- Add stimulus:manifest:update to the tasks description HOT 1
- Error in lib/install/stimulus_with_node.rb
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from stimulus-rails.