barneycarroll / mithril.exitable.js

Exit animations for Mithril components: provide controllers with an `exit` hook which will trigger when the component disappears from the virtual DOM (but before it's removed from live DOM), locking the draw process while you perform animations.
MIT License
22 stars 3 forks source link

New API: specify ancestor components for localised view freezing #11

Open barneycarroll opened 8 years ago

barneycarroll commented 8 years ago

Currently, when an exit animation triggers, Exitable freezes the entire application until the component finishes it's animation, then persists the view snapshot that removed the component.

This is because it's incredibly tricky to determine what parts of the view are safe to keep 'live' (eg you can't persist a removed item in a dynamic list while allowing the rest to redraw).

However in the case of deeply nested components, the user should be able to specify ancestor components such that only that ancestor is frozen during exit, allowing the rest of the app to function as normal — eg an item is removed from the shopping basket, this the shopping basket is prevented from redrawing while it exits, but the other menus and main content of the site can continue to be interacted with as normal.