npm install @genestack/system-api
Returns a Promise that resolves when all application resources are loaded. Promise resolution
handler is called with the object that represents current application.
import {loadApplication} from '@genestack/system-api';
loadApplication().then((app) => {
console.log(app.applicationId); // "your-vendor/your-app-id"
})| Name | Type | Comment |
|---|---|---|
applicationId |
string | your-vendor/your-app-id |
parameters |
Array | Array of parameters app was loaded with (usually list of file accessions) |
action |
string | Action app was loaded with (e.g. openInBrowser, openFile, createFromSources etc.) |
applicationVersion |
string | Application version |
applicationName |
string | Human readable application name |
pathname |
string | pathname URL part of the application, e.g. /endpoint/application/run/your-vendor/your-app-id |
resourcePath |
string | URL part, pointing towards root folder of application resources, use it e.g. like `${app.resourcePath}relative/path/to/image.png` |
Returns a Promise that resolves with application properties. Promise resolution handler is called with the object that represents the properties of the application with the applicationId argument.
loadApplicationProperties(applicationId).then(({pathname, applicationId}) => {
console.log(pathname);
console.log(applicationId)
})applicationId is the string identifier of any deployed application.
| Name | Type | Comment |
|---|---|---|
pathname |
string | pathname URL part of the application, e.g. /endpoint/application/run/your-vendor/your-app-id |
applicationId |
string | Application identifier |
Invoke a Java method from an application's class. Returns a Promise that is resolved with
serialized/deserialized value that method returns or rejected with the Error object in case
of any failure.
This method could be used only when application is fully loaded.
import {loadApplication, invokeMethod} from '@genestack/system-api';
loadApplication().then(() => {
invokeMethod(options).then((result) => {
console.log(result); // whatever your server method returns
})
})| Parameter | Required | Type | Default | Comment |
|---|---|---|---|---|
applicationId |
✓ | string | Id of application in format "vendor/application" |
|
method |
✓ | string | Application method name | |
parameters |
✓ | Array | A list of parameters that method accepts. Each parameter should be JSON serializable | |
showBusyIndicator |
boolean | false | Whether a global busy indicator should be shown | |
extendSession |
boolean | true | If true, this method call will extend current user session | |
handler |
Function | Success handler. Called with method's returned value, the same as the Promise resolution value | ||
errorHandler |
Function | Error handler. The same as the Promise rejection value |
Shows the system notification notification (at the top of the application page)
Returns a Promise.
import {showNotification} from '@genestack/system-api';
showNotification('Hello, World!', 'success');| Parameter | Required | Type | default | Comment |
|---|---|---|---|---|
message |
✓ | string | Text message | |
type |
string | warning |
One of success, warning, error |