intercellular / cell

A self-driving web app framework
https://www.celljs.org
MIT License
1.5k stars 94 forks source link

Simpler API #25

Closed guscost closed 7 years ago

guscost commented 7 years ago

This implements changes to the API according to discussions in #12, #20 and #23:

Here's a gist demonstrating the new API (the flux-like stuff is just another experiment):

https://gist.github.com/guscost/d47e3437e75cd72293cede3ef847121d

And a live demo:

https://guscost.github.io/cell/test/todos.html

devsnek commented 7 years ago

$contents isn't inherently explanatory of the fact that it will include elements of the same type as the parent, as $children (which is a general standard in programming) or $components (which is also kinda a general standard) would be.

Creating an API is cool, not sure about polluting global just yet. Perhaps it could be scoped into the root cells instead of polluting global, although that falls back to letting cell run for you.

guscost commented 7 years ago

How about a UMD module? I've gotta test this but the header now loads as AMD, CommonJS or on the root as a fallback.

guscost commented 7 years ago

OK, the UMD module looks good. Also fixed merge conflicts.

gliechtenstein commented 7 years ago

Wow thanks for the PR, I really appreciate that you've questioned a lot of things.

First of all, there's a lot of things going on here, which is why I've been hesitating where to start.

Since this PR is related to pretty much the majority of all the currently open issues, I've been trying to figure out a best way to respond most efficiently.

I think it would be best if I share my side of the story as a single post (how I came up with the naming convention, architecture, and little implementation details, and why) and then take it from there instead of replying to each thread, so that we can centralize the discussion around these issues.

I'm going to write up something today and post it as github issue sometime today, I hope to continue the conversation about this PR after that. Thank you!

jordalgo commented 7 years ago

👍 Overall, great changes, especially:

Added an imperative API. Run Cell() passing in a cell object to start up after page load.

guscost commented 7 years ago

@gliechtenstein sounds good, I'll try to keep these somewhat in sync with other updates but this particular branch could just be a vehicle for discussion too.

piranna commented 7 years ago

Cell variable

It's not a variable, it's a namespace ;-) They are similar but have subtle differences in concept :-)

guscost commented 7 years ago

It's both, depending on the context.