Skip to content
This repository has been archived by the owner on Aug 1, 2022. It is now read-only.

api import

Ayhan Rashidov edited this page Sep 27, 2021 · 9 revisions

$.import API

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'.

Reference

  • SAP Help

https://help.sap.com/doc/3de842783af24336b6305a3c0223a369/2.0.03/en-US/$.html#import

  • Module

https://github.com/SAP/xsk/blob/main/modules/api/api-xsjs/src/main/resources/META-INF/dirigible/xsk/import

  • 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

https://github.com/SAP/xsk/issues/18

  • Unit Tests

https://github.com/SAP/xsk/blob/main/modules/engines/engine-xsjs/src/test/resources/test/xsk/import/import.xsjs

  • Integration Tests ❌

✅ - Feature implemented and working as supposed.
⚠️ - Feature partially implemented and needs to be finished.
❌ - Feature not implemented yet.

Project

Architecture

Tips & Tricks

Infrastructure

Troubleshooting guide

Clone this wiki locally