Skip to content

Instantly share code, notes, and snippets.

@o0101
Last active August 28, 2020 10:22
Show Gist options
  • Save o0101/0bc6028dad8e3f62d9db4113c950f254 to your computer and use it in GitHub Desktop.
Save o0101/0bc6028dad8e3f62d9db4113c950f254 to your computer and use it in GitHub Desktop.
Zember.js ~ components from iframes
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?
@o0101
Copy link
Author

o0101 commented Oct 14, 2019

So it's an exclusively server side framework?

I kind of like this. It's like "enterprise grade solid"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment