JavaScript Reference Functionality
- Updated2023-02-17
- 1 minute(s) read
JavaScript Reference Functionality
JavaScript references behave similarly to references for other data types, but have some unique functionality.
When using JavaScript references in your web application, you need to consider the following:
- Primitive values null and undefined—JavaScript references treat primitive values null and undefined the same as other primitives, such as strings, booleans, numbers, etc. If a value of null or undefined is returned, it generates a new JavaScript reference that you need to clean up to prevent memory leaks.
- Not a Number/Path/Refnum? behavior—The node tells you if the value is valid, but it does not tell you if the JavaScript reference value is null or undefined. There is not an existing node to check for values of null or undefined.
- JavaScript values—JavaScript references can hold any JavaScript value, including primitives and objects, such as JavaScript functions, HTML elements, and class instances.
- Type definitions containing a JavaScript reference—JavaScript references do not
have front panel representations, so you will need to use the following process
to create a type definition containing a JavaScript reference:
- Create a VI (.gvi) with a web server target in your web application project.
- Add your JavaScript reference to the diagram.
- In the Configuration pane, click Change to Type Definition.
Related Information
- Creating UI Elements with JavaScript
Create UI elements to place on the panel of your web application using the Placeholder HTML Container and JavaScript Library Interface document (JSLI).