natemoo-re / micromorph

A very tiny library for diffing DOM nodes
https://stackblitz.com/edit/micromorph-demo
MIT License
345 stars 9 forks source link

Export `diff`, `patch` functions #1

Closed Monkatraz closed 2 years ago

Monkatraz commented 2 years ago

Heya, this is a cool, tiny library - thanks for making it. I've used it to replace our usage of MorphDOM in our editor's live preview system. One thing I wish I had access to was the diff and patch functions - currently you can only use the convenience function for doing both at the same time.

The reason why I would want to do this is so that I could spread out the diffing and patching process over time so I can prevent stuttering in the editor. It would also be neat to have some manual control over the patching.

natemoo-re commented 2 years ago

I can definitely expose them both! Wasn’t sure if there was a good case for using them individually, but that makes a lot of sense.

As for more control over patching, I’m currently experimenting with different ways to expose hooks into the diff and/or patch process. Would you mind opening another issue with more details of your use cases?

Monkatraz commented 2 years ago

I actually meant "Another reason this feature would be nice would be because it would give you some more manual control", I used bad wording. I don't actually think I have any particular desire for hooks in the patch or diff functions yet. I'll definitely make a separate issue and describe in detail what we're doing if a need for hooks crops up.