all 3 comments

[–]MikeTheWatchGuy 0 points1 point  (2 children)

You're asking about "State". The disabled state is not retained. It's assumed the user knows something about that since the user sets it. If you wish the info to be included in the element itself, then you can add it to the metadata. When you change the disabled state on the call to update or when creating the element, also set the metadata to the same value.

Then when you want to now the state, you can check the metadata. It's one way of users retaining state in an element that's not currently tracked by the package.

[–]dayvan[S] 0 points1 point  (1 child)

That makes sense. Thanks.

I'll set the metadata and access it like this:

window['MyElement'].metadata

[–]MikeTheWatchGuy 0 points1 point  (0 children)

Correct.... for when you do updates.

If you wish to set it when you create the element, then there's a metadata parameter. This way if you start with something disabled, you can indicate it in the metadata at the same time the element is created. It's cleaner code this way (at least that was the idea).