I am trying to use x-tag accessors but I'm not finding a good documentation about them.I would like to pass a function through an accessor and write something like this:
<my-element logic="myFunction()"></my-element>
And I want to save that function and use it later. Is there any way to do that?
I'm really not sure what you're trying to accomplish, but I'll give it a shot. If you are trying to make some logic available on all
<my-element>
tags, use themethods
object, like this:If you want to be able to assign
logic
to each instance of<my-element>
individually, then you could use a standard (non-attribute) accessor, and do so implicitly.HTML
Set logic for one instance of
<my-element>
If you want to use an attribute to set the value of
logic
to a global function, you could do this:Example global function
Component
Usage (HTML)
Usage (JS)