Created
May 8, 2025 15:21
-
-
Save amb26/2164b1cb78ddf069e1b5f1dcbd695dcb to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // Many thanks to Hugo Daniel https://hugodaniel.com/pages/boredom/ for inspiration for this concept | |
| fluid.selfBootQuery = fluid.liveQuery("*[fl-layers]"); | |
| fluid.selfBootEffect = effect( () => { | |
| const elements = fluid.selfBootQuery.value; | |
| elements.forEach(element => { | |
| const existing = fluid.viewContainerRegistry.get(element); | |
| if (!existing) { | |
| const layers = element.getAttribute("fl-layers"); | |
| const instance = fluid.viewComponent({ | |
| $layers: layers, | |
| container: element | |
| }); | |
| // Put this in early in case instantiation fails | |
| fluid.viewContainerRegistry.set(element, instance); | |
| } | |
| }); | |
| }); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment