dom - kotlin-js extending kotlinx html classes -


i have tried learn kotlin language week , wanted make simple class acts html element.

at first, saw org.w3c.dom library's "htmlelement" , chidlren, extending more of pain have ever seen in life. problem is abstract , has 20 members have implement, provide logic , hope correctly.

class customelement : htmldivelement() {} // no-go 

then used kotlinx.html library create normal divs , other elements, thought "i can extend those".

class customelement : div() {} 

a thing wasnt abstract, dont have shit , works right? well... not fast, have provide 2 parameters constructor has. haven't found documentation of searching in range of "kotlinx html div constructor" "chuck norris" result in similar topics following:

element.append {     div {         +"added it"     } } 

which nice, not want. first parameter pretty easy understand constructor's declaration named "initialattributes" i'd assume 'class="my-class" id="myid", style="display:none;"' etc. providing empty hashmap sufficient case. there other parameter "consumer: kotlinx.html.tagconsumer<*>" of have no idea of do, wants , should provide.

i can't provide "null" kotlin complain it, can't make instance of interface, , google hasn't helped me out either... again.

tl;dr:

what have place on question marks in following code:

class customelement : kotlinx.html.div(hashmap(), ???) { /* todo */ } 

or, should use instead of kotlinx.html.div extend make custom html elements?


Comments

Popular posts from this blog

Is there a better way to structure post methods in Class Based Views -

performance - Why is XCHG reg, reg a 3 micro-op instruction on modern Intel architectures? -

jquery - Responsive Navbar with Sub Navbar -