PJS Ver 5 Low-Code API

Use this board to ask questions or have discussions with other Profound.js users.
James-S
Profound User
Posts: 61
Joined: Tue Jun 28, 2016 12:53 pm
First Name: James
Last Name: Sherwood
Company Name: Brunswick Boat Group
City: Knoxville
State / Province: Tennessee
Contact:

PJS Ver 5 Low-Code API

Post by James-S »

I am learning how to use the low-code feature in Profound.js v5. I have a simple existing javascript source which accepts and returns a value which I want to invoke via custom step.

I see two custom step options.

1. Call node.js program
2. Write custom node.js code

Are these the only two means to call custom javascript? Is there a way to call a specific function within javascript code which has many functions in it?

As I mentioned I am learning so I am at ground zero here. If there are good tutorials working with custom javascript, that would be good too.

Thanks!
Scott Klement
Experienced User
Posts: 2711
Joined: Wed Aug 01, 2012 8:58 am
First Name: Scott
Last Name: Klement
Company Name: Profound Logic
City: Milwaukee
State / Province: Wisconsin

Re: PJS Ver 5 Low-Code API

Post by Scott Klement »

We are currently working on extending this type of functionality for a future release, and that may help you. But for the time being, you'll have to write a custom block of Node.js (JavaScript) code.

If your existing source is a Profound.js module, you could call it with "Call a node.js program", but that currently doesn't let you return values. (Again, this is being improved for the future.) So instead you'd want to write a custom node.js code to call your Profound.js module like this:

Code: Select all

let pgm1 = pjs.require("program1.js");
let result = pjs.call(pgm1.myFunction, myParm);
https://docs.profoundlogic.com/x/SIHkAQ

If your source is not a Profound.js module, then you would code custom Node.js code like this:

Code: Select all

let pgm1 = require("program1.js");
let result = pgm1.myFunction(myParm);
If your code does anything async, it may need to be wrapped in a fiber.
https://docs.profoundlogic.com/x/2YTrAQ
James-S
Profound User
Posts: 61
Joined: Tue Jun 28, 2016 12:53 pm
First Name: James
Last Name: Sherwood
Company Name: Brunswick Boat Group
City: Knoxville
State / Province: Tennessee
Contact:

Re: PJS Ver 5 Low-Code API

Post by James-S »

Scott,

Good to hear Profound is building further javascript support in you low-code support.
Post Reply

Who is online

Users browsing this forum: No registered users and 0 guests