Table Of Contents

Defining Calls to JavaScript Functions using a JavaScript Library Interface

Last Modified: November 16, 2020

To call JavaScript functions in your web application, define calls to the JavaScript functions using a JavaScript Library Interface (JSLI) document.

Before you begin, create or open a web application project and prepare your JavaScript code for use with the JSLI. For more information on JavaScript concepts, refer to JavaScript Resources.

For the JSLI to access a JavaScript function, the function must be accessible from the global scope.

To create and configure a JSLI document, complete the following steps:

  1. On the Project Files tab, add a JSLI to a web application component or library component in your project. A JSLI document appears in your web application.
  2. Define the prototype for the JavaScript function you want to call. A defined call to a JavaScript function in a JSLI is called an entry point.
    1. In the JavaScript global form field, enter the name of the JavaScript function you want to call. The name you enter must exactly match the function name in the JavaScript code. You must specify all functions relative to the global scope. Use dot notation to refer to nested objects. For example, if you want to call the absolute function abs in the object Math, you must specify Math.abs in the JavaScript global form field.

      The JavaScript global form field is case sensitive.

    2. Click Add function to create an entry point. The default entry point name is created from the JavaScript global.
    3. Click Add parameter.
    4. On the Item tab, specify the parameter name, data type, and JavaScript representation. Consider the following information when you add parameters to your prototype:
      • You can choose any name for the parameters you add to a JSLI document, but you must add them in the same order as they appear in the JavaScript function.
      • The parameter and return data types you specify in the JSLI document must match the parameter and return data types in the JavaScript function.
      • The parameter in the top position in the JSLI document is always the return type.
  3. Repeat step 2 to create as many entry points as you need for your project.

Recently Viewed Topics