-
-
Save Raynos/49be1da3f12823a52b70 to your computer and use it in GitHub Desktop.
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
/* | |
dataRepresentation is some representation of the data over time. | |
Either a stream, EventEmitter, Reducible or (any old mutable data + Object.observe) | |
*/ | |
function SomeWidget(dataRepresentation) { | |
// A widget can use whatever templating scheme it likes | |
var elements = invokeTemplate() | |
// A widget data binds the data representation onto it's DOM by some | |
// kind of binding schema. | |
oneWayDataBind(elements, dataRepresentation, someDataBindSchema) | |
// A widget grabs all relevant user input out of the DOM thing | |
// And transform it into a result. | |
var result = transform(userInputFrom(elements), function () { | |
/* transform DOM input into some kind of useful DOM agnostic data structure */ | |
}) | |
// A widget must expose both the DOMElement and the result (somehow) | |
result.view = elements.root | |
// A widget's result is some representation of data based on user input over time | |
// So either stream, EventEmitter, Reducible or (mutable object + Object.observe) | |
return result | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment