onAfterChanges option (or something similar)
See original GitHub issueFirst of all thanks for this great library. I am using it for small reactive widgets in websites and it works like a charm.
In some scenarios i need to know, when morphing is completely finished. My approach now is to add onElUpdated
, onNodeAdded
and onNodeDiscarded
and inside of the callbacks fire another callback which is throttled by request animation frame. This works for me, but is a little bit hacky in my opinion.
Would it be possible to provide an option - like onAfterChanges
- which becomes invoked after everything has been done?
Issue Analytics
- State:
- Created 2 years ago
- Reactions:2
- Comments:7
Top Results From Across the Web
kenwheeler/slick - I'm confused by the onAfterChange option
How do I pass the index to my function? currently, I'm doing this. var afterChangeFunc = function(index) { // do something; } mySlideshow.slick ......
Read more >Slick slider on('afterChange')
I am trying to find option or method that gives me ability to change ... After change on the next slide, I would...
Read more >HTMLElement: change event - Web APIs | MDN
The change event is fired for , , and elements when the user modifies the element's value. Unlike the input event, the change...
Read more >JsViews custom tag controls: Declaring options
An alternative syntax is useful for declaring multiple tags: ... The onAfterChange() handler is called after tag has been updated by an observable...
Read more >Tour API | Intro.js Docs
Parameters: options : Object - Object that contains option keys with values. Returns: introJs object. Example:.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I share your desire; it would be nice. In fact, I’m implementing a comparison concept in a library that uses morphdom right now.
Thing is, I would rather have morphdom be super fast than provide a changeset. I genuinely worry that making those changes available would require a lot more code and a lot more CPU cycles to run that code. (I’d be thrilled to be wrong.)
In our library, given that this functionality hasn’t been merged and released yet, we’re making use of the techniques discussed earlier in this thread - paired with an initial check where we compare the source fragment against the innerHTML of the target element. We figure that even if this is a heavy operation, it’s still less heavy than calling morphdom if we know the source and target are already equal.
If this functionality does get merged down the line, we’ll take that as an opportunity to simplify our local implementation by adopting the morphdom onAfterChanges event.
Building on @StefanJelner’s solution - while acknowledging that I’m hoping for an outcome where a callback fires after processing even if there are no changes - is it fair and reasonable to say that a final call to
onAfterChanges()
immediately before line 753 would do the trick?