max-mapper / yo-yo

A tiny library for building modular UI components using DOM diffing and ES6 tagged template literals

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

onload / onunload events

kristoferjoseph opened this issue · comments

commented

@shama How do you need to write yo-yo components to take advantage of bel's onload / unload behavior?

commented

We're waiting for a new morphdom release to add support for this; I created a lil playground to show off how to create stateful components with morphdom ✨ - we should probably create a nice lil wrapper that can memoize based on arguments at some point, but hope the repo can provide some help for now - cheers! ✌️

See Also

commented

Nice! I'm down to write a wrapper. Did you link to the playground you wrote?

commented

Did some more experiments and load/unload work currently, but not for cached elements, that was my issue. I see now why you jumped directly to that comment @yoshuawuyts.
Was looking at how diablo is adding more lifecycle events. Would be nice for adding css intro and exit transitions.

commented

@kristoferjoseph I think extra lifecycle events can be evaded by using a finite state machine; onload / onunload should be the only hooks needed at the component level to create css animations. Perhaps take a look at the f1 package for an example of an animation state machine