Last active
August 28, 2020 10:22
-
-
Save o0101/0bc6028dad8e3f62d9db4113c950f254 to your computer and use it in GitHub Desktop.
Zember.js ~ components from iframes
This file contains 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
zember installs the following function | |
document.createComponent( | |
markup, | |
frameStyle, | |
innerStyle, | |
code | |
); | |
And produces an iframe styles like frameStyle, with its internal document styles like frameStyle, | |
having the markup of markup and any script of code. | |
I think this is generally a great idea for a high value framework. | |
One thing I'd like to workout is elegant syntax for | |
render from state | |
And elegant syntax for communication from component back to app root. | |
Such as for event delegation, or other things. | |
A revision | |
document.createComponent( | |
name, | |
markup, | |
frameStyle, | |
innerStyle, | |
code, | |
options = { | |
keyed: false | |
} | |
); | |
Once created a non keyed component can be accessed like: | |
Component[name] | |
A keyed component can be accessed like: | |
Component[key][name] | |
The component itself has the following API | |
component(state) -> render in place | |
component.to(location, elementOrSelector) -> move to location | |
component.remove() -> delete from DOM | |
component.destroy() -> delete from components table | |
Templating can obviously be done via template literals | |
But what about includig a component in another? | |
What about attaching event listeners? | |
What if --- there are NO event listeners. What if everything is forms? | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
So it's an exclusively server side framework?
I kind of like this. It's like "enterprise grade solid"