In your script you’ll need to extract the paramlists using the properties get() method to send them to the outputlists as arrays. There’s more information in the plugin’s documentation.
Essentially what Toolbox is doing is running code through it’s plugin elements’ instance and any lists passed to an instance is a Bubble ‘properties’ object that needs to be extracted using it’s get() method.
Is there a reason that the “Expression” element has no inputs/params? It’d be very handy in a few places. For example, string formatting in a repeating group.
I’m sending a date in a url_param and when the date gets to the page I need to extract it from the url. And convert back to a date,
I’m using and expression date(‘get data from url param’) and its resulting a date
Now question I’m trying to set the Initial content at a date time picker for the url ‘result of the exp date’ but it’s empty and the Initial content shows up as today’s date
I tried to store in a state but it not getting set, so I’m figuring that the exp gets evaluated after page is loaded already and the initial content is being set before it’s evaluated,
@mishav thank you for your response regarding the dates, i will clarify my original question is when is the expression running on page load ? or after page load
Curious: is every Javascript to Bubble with trigger event checked, an event listener on the page? Or some sort of Bubble signal implementation?
Performance-wise, would it be better have 1 “global” Javascript to Bubble that you can then pattern-match to a certain action, or 10 distinct Javascript to Bubble each representing one action?
I think each bubble_fn is basically an event listener.
From a performance perspective, I don’t think it’s possible to have just one global listener Javascript to Bubble, but we can think strategically about having certain JavaScript to Bubble elements placed in specific place on the page.
Then, we just use Run JavaScript actions to coordinate and trigger events for these global JavaScript to Bubble elements.
I do this a lot, especially in structures where I have reusable elements within reusable elements.
I think it depends, because in Javascript To Bubble we can pass a number of parameters, sometimes depending on what we want to create, we need the parameters themselves, and that would be limited if we only had Javascript To Bubble, but in your case, for example, it seems that you use it to open a popup and define the popup type, I believe it should work perfectly.
But having only one Javascript To Bubble for whatever you want, in the end, I think it will depend on the app.
@carlovsk.edits , @rico.trevisan Performance impact of more event listeners for the separate JS2B’s would be negligible at such a low volume. On the other hand, reducing the number of plugin elements active is really helpful.
Be aware that the JS2B’s outputs are REPLACED by the next event, so if the events are triggered faster than bubble is handling them, potentially a newer value will be used in an older workflow.
I’m inconsistently getting: The plugin Toolbox / action Run javascript threw the following error: ReferenceError: arguments is not defined at eval (eval at hooks.call (:92:62), <anonymous>:1:18) at eval (<anonymous>) (please report this to the plugin author)
I saw in the plugin code this eval: eval(“var properties = arguments[0]; context = arguments[1];”);
Is there something i can do to prevent getting that ReferenceError?
Cause 2: Bubble’s plugin editor making an arrow function instead of a regular function. I hope this is not happening! Possible if Bubble has changed versions of webpack or equivalent.
arguments is used to make properties and context available to the evaluated script, as a workaround for the plugin minify process renaming them.
Can you provide more info? Such as, browser/OS version, if params used, etc
Is anyone else seeing this?
Not yet. I could get the plugin to check for arguments existence, but if missing it is a sign that something is unexpected and likely to cause further problems if continuing.