This repository has been archived by the owner on Aug 1, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 31
api import
Ayhan Rashidov edited this page Sep 27, 2021
·
9 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'.
- SAP Help
https://help.sap.com/doc/3de842783af24336b6305a3c0223a369/2.0.03/en-US/$.html#import
- Module
- Sample usage:
in xsk:
root/
|-- sap
|--import.xsjs
|--myapp
|--lib
|--math.xsjslib
- 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) |
// 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);
- Issues
- Unit Tests
- Integration Tests ❌
✅ - Feature implemented and working as supposed.
❌ - Feature not implemented yet.