[New Feature] Ability to initialize states for plugins

Hello,

This update is for plugins element builders. As you’ve noticed the code you write gets run when the element becomes visible, which can lead to the exposed states not having the right value at first. We added a way for you to add an initialization function for an exposed state, which should return what the state should be until another part of your code (in initialize or update) changes the value. You can access the properties object in that function.

Note that for existing states, you’ll need to paste this in the code editor to start adding code, while for new states this will be pre filled by the editor.

function(properties, context) {



}
10 Likes

Hey @emmanuel

I am trying to make use of this but i am currently lost on how to have a default value. Can it be used like this

 function(properties, context) {
return "Some Value"
}

Yeah I think that is it @AliFarahat
I have the below syntax working fine for me:

 function(properties, context) {
      var state = "default value";
      return state;
    }
1 Like

great i am glad i got it right for once

2 Likes