-
Notifications
You must be signed in to change notification settings - Fork 3
api import
Ayhan Rashidov edited this page Sep 5, 2022
·
3 revisions
Imports a server-side JavaScript library artifact.
The library is a design-time artifact located in the repository. JavaScript library design-time artifacts have the suffix '.xsjslib'.
https://help.sap.com/doc/3de842783af24336b6305a3c0223a369/2.0.03/en-US/$.html#import
root/
|-- sap
|--import.xsjs
|--myapp
|--lib
|--math.xsjslib
// import .xsjslib to our file using $.import api ("package","library")
//in our case package equals "sap.myapp.lib"
var mathlib = $.import("sap.myapp.lib","math");
var response = require('http/v4/response');
var square = mathlib.square(6);
var multiply = mathlib.multiply(4,9);
var division = mathlib.division(9,3);
response.print("number is "+ square);
response.print("devision = "+ division);
response.print("multiply = "+ multiply);
- Parameters:
Name | type | Description |
---|---|---|
package | string | The name of the package in which the library object is located |
library | string | The name of the library object in the repository (without the suffix .xsjslib) |
✅ - Feature implemented and working as supposed.
❌ - Feature not implemented yet.