Active-CSS / active-css

The epic event-driven browser language for UI with functionality in one-liner CSS. Over 100 incredible CSS commands for DOM manipulation, ajax, reactive variables, single-page application routing, and lots more. Could CSS be the JavaScript framework of the future?
https://activecss.org
Other
41 stars 7 forks source link

External triggers on scoped component elements are not fetching component details #306

Closed bob2517 closed 1 year ago

bob2517 commented 1 year ago

This is using the JS external command ActiveCSS.trigger(el, "myEvent");

The visible effect on my example is that it pulls private vars out into the main document scope, which is no good. That example was based on calling an event outside the component, but yet still needed to inherit the variable scoping.

The solution, without re-writing how component details are fetched in the event loop, is to fetch the component details in the external trigger command and call the event loop with those details. This is perhaps more performant anyway, bearing in mind the way the event loop is currently structured. It's maybe worth revisiting the event loop structure now that the core is stable and seeing if there is or isn't a better way to organise it.

This solution should also solve the problem of accessing inner component events when externally called.

bob2517 commented 1 year ago

This is fixed on the branch for trigger on anything but a trigger on a draw event. Still to do that. Added the trigger-fresh command with accompanying ActiveCSS.triggerFresh command, which should hopefully solve any memory leaks on infinite loops, but still more tests to do on that before it's documented.

bob2517 commented 1 year ago

Skipping draw event implementation for now - could add that in later if it comes up.

bob2517 commented 1 year ago

Closing in preparation for release.