Toolbox plugin - collection of utility elements

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.

Thank you. Makes sense. This is the first time I needed to send a list which explains why it worked previously.

I’m still curious on how to map the five options in the Run JavaScript action to the four options in the JS2Bubble event.

@morningagent - Did you resolve this issue? I am having the same problem.

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.

Hi

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,

Can anyone please help me

Thank you

The key to reliably passing the date is: formatting the date, to yyyy-mm-dd (and optionally time), before sending to the other page.

Some examples on this editor page: https://bubble.io/page?id=toolbox-example&tab=Design&name=url-param-1&type=page

(This is not really a Toolbox question FYI)

It is on my ideas plan, I de-prioritised it after mostly negative feedback on the other elements params.

@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

Both, whenever the expression updates.

Thanks for clarifying, I missed this earlier.
Can you show a screenshot of the exact expression, and the dynamic values used?

I’ve updated the example to use Expression with:

new Date( 'Get d1 from page URL' )

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.

Can you not? I created something like this

It’s all the same Javascript to Bubble and then I match the first output to whatever action I want to run.

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.

To handle this situation, turn on JS2B’s queuing feature, as described in Javascript to Bubble - Toolbox docs

@mishav Hey there!

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?

Thank you for your time!

Hi @facundo1

There are two possible causes for this error …

Cause 1: Running in an unsupported browser version, see arguments browser compatibility

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.

Another possible cause is arguments being used in your script inside an arrow function. Can you check?