reren
A simple javascript viewengine inspired by viewengines like React, Angular and KnockoutJs
Example/Idea:
var R = ;var MyComponent = R;RstartMyComponent document;
Component API
To create a new Reren Component you use the following API:
var R = ;var MyComponent = R;
Controller
Method | Description |
---|---|
this.onUpdate | Called when the component is updated by it's parent component |
this.model | A controller always has a model object available that will be passed to it's view |
this.update | When called, will trigger the view to rerender again (Will also notify child components 'onUpdate') |
View
The view will be injected with the model from the controller (if the controller is defined) and it should always return a single VElement instance to be able to construct and compare the virtual dom;
{return R;}
VElements
VElements are used to define your (virtual) DOM and they can be used in the following ways:
// default api: new VElement(tagName, attributes, children || content);"div" id: "my_id" "some text";"div" id: "my_id" "span" null "some text";"div" id: "my_id""span" null "first""span" null "second";// shorthand api: R.div(attributes, children || content);R;// creating a nested Component: new VElement(Component, model);NestedComponent model;