joshuagruenstein / snooze

A lightweight JS front-end microframework for API-first webapps.
MIT License
1 stars 0 forks source link

Integrate and Polish Minimorph #4

Closed joshuagruenstein closed 7 years ago

joshuagruenstein commented 7 years ago
joshuagruenstein commented 7 years ago

A word of warning: currently, whenever the pipe is re-queried, event listeners are completely regenerated on the DOM. This is ok now, because the DOM will have been completely wiped and regenerated from the last time events were bound (so there won't be any duplicate listeners). However, just remember that when virtual DOM is implemented, we should check if a listener already exists before regenerating it.

joshuagruenstein commented 7 years ago

Ok, so I've done something kinda weird in ac87b1b6a27ae835302da46d5fc96b7e969d4e33. I basically forked and modified Morphdom into something called minimorph.js. I removed all of the features Snooze doesn't need and cleaned up the code a bit: it's now only 150 LOC. For development I'm just including both minimorph.js and snooze.js, but in the real world I can see two things happening. One, our "packaging" script concatenates minimorph and snooze and minifies the whole shebang. Two, minimorph integrates itself into snooze enough (via stuff like handler and model diffing) to merge it into snooze.js proper. We'll see where things go, but this is definitely an ongoing struggle, so I'm leaving this issue open.

joshuagruenstein commented 7 years ago

There aren't really concrete things that need to be done here, so for the moment I'm gonna close this issue. I'm sure bugs will be found in minimorph implementation, and when they come we'll deal with them.