question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Node constructor arguments

See original GitHub issue

lona.html.Node takes a list of child elements as *args.

Div(
    child_1,
    child_2,
    child_3,
    id="my-id",
    _class="my-class",
)

Here I see two issues:

The first is that all children and attributes have the same indentation. It makes hard to distinguish them.

The second is that I can’t put other attributes (id, style, class, …) before children. For example in dash I can do following (more pretty):

Div(id="my-id", className="my-class", children=[
    child_1,
    child_2,
    child_3,
])

Note: because children is the first argument in dash, I can omit its name:

Div([
    child_1,
    child_2,
    child_3,
])

What do you think about change an API (of course it will be a breaking change)?

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:6 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
maratoricommented, Aug 26, 2021

Yes, I think it is a good idea.

0reactions
maratoricommented, Aug 27, 2021

@fscherf Great, thanks!

Read more comments on GitHub >

github_iconTop Results From Across the Web

Node.js require class with constructor parameter
And it throws an exception, require is not a function , but without a constructor, everything is fine, so the question is how...
Read more >
constructor - JavaScript - MDN Web Docs - Mozilla
The constructor method is a special method of a class for creating and initializing an object instance of that class.
Read more >
How to pass parameters when instantiating a node
I am a bit confused about how to pass 'constructor' parameters to this Sprite node when instantiating it from inside another scene.
Read more >
JavaScript Named Arguments and Class Constructors
JavaScript named arguments can be used in class constructors and normal methods for software robustness.
Read more >
Simplify means of constructing JS class with C++ arguments
Get compile-time checking of C++ constructor arguments ... If anything, there may be some node-addon-api helper wrapper to create External<> ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found