JSideris / DOThtml

A human-friendly way to build highly-dynamic web pages in pure JavaScript.
2 stars 4 forks source link

V6 bindings overhaul. #167

Open JSideris opened 6 months ago

JSideris commented 6 months ago

Requirements

Work Breakdown

Binding Objects

We can either use a binding factory or a class. Factory might actually be best. These binding objects could be set up inside of the build function in a component class.

Binding objects will have get and set functions.

Binding Setup

When a VDomNode is passed a binding object as a child (either as an attribute value or content), it will request that the binding keep it posted with any changes. The binding itself will maintain an internal list of VDomNodes that are subscribed to it. Calling the set function on the binding will update the appropriate attribute or element.

Event System

It will be possible to configure a callback that gets called when the binding value gets updated.

Inputs

Updating the binding value can be done any time from anywhere by calling the binding's set function. The framework will also have the ability to update the binding from various input elements such as input and textarea.

Cleanup

Need a way to clean up the binding when the element it's bound do gets destroyed.