Skip to end of metadata
Go to start of metadata

It is possible to pass parameters to an alias defined under initialModules in your Profound.js configuration file.

 

For this, let's take the connect4.js example. In the initialize function, Math.random() is used to decide who will have the first turn.

Instead, let's make it so we can pass the 'turncolor' in as a variable. To do this, we will add a parameter to both the connect4 and the initialize function, as well as adding the logic to handle the parameter:

This means we can still call our connect4.js example normally, but in addition, we can also call it with a parameter. Both of the following alias URL's are valid:

 

Parameter sequence

The names of the GET parameters in the URL are irreverent. What is important is the sequence they are passed in and the sequence should always match the order of the calling program's parameters.

For example, let's use this program function:

Valid ways of calling this via an alias are:

  1. http://localhost:8081/myprogram?username=ProfoundLogic&emailaddress=me@me.com
  2. http://localhost:8081/myprogram?p1=ProfoundLogic&p2=me@me.com

An invalid way might be:

Labels
  • No labels