Ken
Ken
WWindmill
Created by Ken on 4/23/2024 in #help
global variables
perfect for the use case then. Closing / reloading the browser marks the restart of a session. We are only concerned with the state being unique to a user and session. 😄
5 replies
WWindmill
Created by Ken on 4/23/2024 in #help
global variables
No description
5 replies
WWindmill
Created by Ken on 4/10/2024 in #help
Creating button eventListeners
// Define a function to update the state based on the last button pressed function updateStateWithLastButtonResult(buttonId) { // Assuming the result of the button press is stored in a similar manner for each button // For example, if each button press updates a global variable with its result let result; switch (buttonId) { case 'a_a': result = a_a.result; // Assuming a_a is an object with a result property break; case 'c_a': result = c_a.result; // Assuming c_a is an object with a result property break; case 'e': result = e.result; // Assuming e is an object with a result property break; case 'd': result = d.result; // Assuming d is an object with a result property break; default: console.error('Unknown button ID'); return; } // Update the state variable 'foo' with the result state.foo = result; // Link the updated state variable 'foo' to the textarea with id 'j' setValue('j', state.foo); } // Example usage: // Assuming there's a way to listen to button presses, call updateStateWithLastButtonResult with the pressed button's ID // This part is pseudo-code, as the actual implementation depends on how the buttons are set up // buttonPressListener('a_a', () => updateStateWithLastButtonResult('a_a')); // buttonPressListener('c_a', () => updateStateWithLastButtonResult('c_a')); // buttonPressListener('e', () => updateStateWithLastButtonResult('e')); // buttonPressListener('d', () => updateStateWithLastButtonResult('d')); // Note: You'll need to implement or use an existing function similar to buttonPressListener // to actually listen to button presses and call updateStateWithLastButtonResult accordingly.
10 replies
WWindmill
Created by Ken on 4/10/2024 in #help
Creating button eventListeners
Nothing came up related to button on click eventListeners. For this particular case, I think we will need a background runnable That listens for a button click event and sets a some variable based on the button clicked. Example code below.
10 replies
WWindmill
Created by Ken on 4/10/2024 in #help
Creating button eventListeners
Cool, I will check these and see if I can get something along the lines.
10 replies
WWindmill
Created by Ken on 4/10/2024 in #help
Creating button eventListeners
would you mind giving me a sample code to use for the buttonClick eventListener?
10 replies
WWindmill
Created by Ken on 4/10/2024 in #help
Creating button eventListeners
Okay, I will give that a shot. Also, if I have multiple users, does each user have a unique instance of the app, or the users use the same app instance? I am asking this because multiple people will be pressing different buttons at the same time, so the variable in state. foo should be unique to each user. I read the documentation and I see windmill has public apps available as standalones, just confirming that the app will be a unique instance to each user?
10 replies