Instance.data.properties = properties;

“Simple” question: is there any (subtle, because I used it and it seems working) issue in using a statement like that in the title of this post, set inside the element update function, so that, inside the initialize function, I can get the values of the set property fields in the property editor?
Thank you!

initialization happens before update, so I do not think if you are putting it in the update function that will make it so that inside initialization function you’d get the values…likely you just need to do that in the initialization function so the values are available for your update function.

1 Like

No issue. It’s common practice.

1 Like

I thought it as a shortcut when you want to initialize, at loading, some variables that must be used across the plugin element functions with values set in the property editor.
In that way you don’t have to, for each of the property field of interest, to define something like this
instance.data.property1 = properties.property1;
in the update function.
Indeed, if you use
instance.data.prooerties = properties;
you have directly all the property values directly in the instance object and you can use directly things like
instance.data.properties.property1
As said that works but, as I am trying to build my first plugin, I was unsure if that thing is accepted by bubble as a safe practice.
Thank you very much for your replies!

1 Like

Okay, this explanation makes more sense to me, as it sounds like you want to initialize the properties in intialization so the update has access…the original explanation as I understood it was asking how to have properties defined in the update function so that they are accessible by the initialization funciton.

Personally, I’m not familiar enough to speak to this with much expertise, so I’d default to @ihsanzainal84 insights

You’re just storing Bubble’s properties object. So it’ll work just fine.

I learned by delving into code of better plugin makers than me.