You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Besides having both stateless and stateful components as pure functions of data, it would be good to also add support for the new Custom Elements style classes and the more traditional D3 components. D3 components should be straightforward given it was the source of the inspiration for the current components. Classes would be expected to have a similar declarative render function (draw) but also allows developers to more neatly setup other methods/accessors/lifecycle hooks/etc. This should also improve interop.
Classical D3 Component
functionchart(){varwidth=720,// default widthheight=80;// default heightfunctionmy(){// generate chart here, using `width` and `height`}my.width=function(value){if(!arguments.length)returnwidth;width=value;returnmy;};my.height=function(value){if(!arguments.length)returnheight;height=value;returnmy;};returnmy;}
Custom Element Class
classMyComponentextendsHTMLElement{// can move name and other meta data here..name: 'my-component'getwidth(){returnthis._width}setwidth(value){this._width=value}draw(node,data){// update nodejsx(node)` ... `}}
The text was updated successfully, but these errors were encountered:
pemrouz
changed the title
feat: add support for more component types (CE classes and D3 functions)
feat: add support for more component types (Custom Element classes and D3 functions)
Nov 30, 2016
Besides having both stateless and stateful components as pure functions of data, it would be good to also add support for the new Custom Elements style classes and the more traditional D3 components. D3 components should be straightforward given it was the source of the inspiration for the current components. Classes would be expected to have a similar declarative render function (
draw
) but also allows developers to more neatly setup other methods/accessors/lifecycle hooks/etc. This should also improve interop.Classical D3 Component
Custom Element Class
The text was updated successfully, but these errors were encountered: