Forum Documentation Showcase Pricing Learn more

Toolbox plugin - collection of utility elements


#142

Seems I should write up some documentation for you sometime!

(I always figured complex data types COULD NOT be returned and that those types in the drop down were just “there” as a side effect.)


#143

Whaat? If we collaborated we’d end up with an ebook called Bubble Javascript Integration Guide, it’d get shortened to BJIG, then it’d become a swearword “I’ll bejig this on ya”


#144

Server script broken versions:
v1.1.0
v1.1.1
v1.1.2

Edit - I had to do some funky workarounds for issues from the minification when publishing.


#145

v1.1.3 New Version

  • Server script - to run a Node script on the server, as a workflow step.

This will be handy if you don’t want to create a plugin of your own for server side code.

Uses

  • Calculations and string expressions, regular expressions.

  • Conversions between types, which has been difficult to do on the server side.

  • Set a value to be used by a subsequent workflow step.

I’ll be putting up some examples soon.

Note that you can run the script from a page workflow, the script will be run on the server, so you’ll notice a delay on the app as the client waits for the result.

Limitations
The script will be stopped with an error after a timeout of 10 seconds.

Global variables aren’t reliably available – you can set them up, but there’s no guarantee that the script will run in the same process when you want to retrieve them.

There are a limited number of Node packages/modules available, Bubble has mentioned they will come up with a process for more to be added.

Caution - if you allow untrusted scripts to run, for example submitted by a user, it could break your app’s server scripting environment, and require intervention by the Bubble team.

Node objects and functions you may find useful.

Node modules/objects:
Object
Function
Array
Number
Boolean
String
Symbol
Date
RegExp
Error
EvalError
RangeError
ReferenceError
SyntaxError
TypeError
URIError
JSON
Math
ArrayBuffer
Uint8Array
Int8Array
Uint16Array
Int16Array
Uint32Array
Int32Array
Float32Array
Float64Array
Uint8ClampedArray
DataView
Map
Set
WeakMap
WeakSet
Proxy
Reflect
Infinity
Promise
Intl
Buffer

Potentially useful functions:
parseInt
parseFloat
escape
unescape
decodeURI
decodeURIComponent
encodeURI
encodeURIComponent
clearInterval
clearTimeout
setInterval
setTimeout
get_object_from_id
get_objects_from_ids

Plus the documented functions assigned for a plugin:
context.request
context.currentUser

Remember to refresh the app editor after upgrading a plugin.


Variables (custom state) in API workflows
#146

Some examples of the server script:

example app editor: https://bubble.is/page?type=page&name=serverscript&id=toolbox-example&tab=tabs-1
example app: https://toolbox-example.bubbleapps.io/version-test/serverscript?debug_mode=true


API posting an array object
Creating, storing, and updating a json file in bubble
#147

New version 1.1.4

  • Minor fix to List Item Expression, lookup() was barfing on null value.

#148

Hi
I am new to bubble, but I love the javascript plug in you created.

How do I get the javscript to appear in my chrome debugger to step through it?

Thanks


#149

Hi @billalbert05,

You’d need to figure out where in the Bubble app to put a breakpoint, and that isn’t something documented by Bubble or easy to find.

If you have complex javascript, I recommend testing on the console first.

I’m glad you find the plugin useful!


#150

Ok, glad I wasn’t missing something obvious. I have debugged it in the console to get it to work, but need to step through to see the data being passed etc.

Any guidance would be appreciated.


#151

You might prefer to create a plugin, the plugin editor can set breakpoints.


#152

Oh Ok, will take a look.