skoppe / spasm

Write single page applications in D that compile to webassembly
MIT License
218 stars 17 forks source link

Pass spasm struct as child #39

Closed henriklundgren closed 5 years ago

henriklundgren commented 5 years ago

Hi,

Apologize before-hand if I picked the wrong forum to ask my question.

How would you pass a Spasm struct instead of a HTMLElement?

struct X
{
  mixin Node!Y;
}

Or what is the recipe to accomplish similar?

skoppe commented 5 years ago

Hi,

There is no dedicated forum for this. Here is as good a place as any.

You can do the following:

struct X
{
    mixin Node!"div"; // optional
    @child Y y1;
    @child Y y2; // can have multiple children
}

A good example of recipes would be the todo-mvc example