Created
November 30, 2016 14:38
-
-
Save Jazarro/22897d7227e0bee280e6ef4b3b22962f to your computer and use it in GitHub Desktop.
TypeScript definitions for the Movilizer.js file needed for Movilizer HTML5 views.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* TypeScript definition file for the Movilizer.js file needed for Movilizer HTML5 views. | |
* The documentation in this file has been adapted from the documentation in the original Movilizer.js file, | |
* presumably written by Jesus de Mula Cano. | |
* | |
* @author Arjan Boschman | |
*/ | |
/** | |
* This declares the global variable movilizer of type Movilizer. The class Movilizer is declared below. | |
*/ | |
declare const movilizer: Movilizer; | |
/** | |
* TODO: Add types to the remaining functions. | |
*/ | |
declare class Movilizer { | |
constructor(); | |
/** | |
* Returns value for given global variable. | |
* | |
* @param key The name of the variable we're trying to read. | |
* @param onSuccess A success callback. | |
* @param onError An error callback. | |
*/ | |
readGlobalVariable(key: string, onSuccess: (value: string) => void, onError: () => void): void; | |
/** | |
* Returns value for given global variable, given a specific namespace. | |
* | |
* @param key The name of the variable that will be read. | |
* @param onSuccess A success callback. | |
* @param onError An error callback. | |
* @param namespace The namespace of the global variable that will be read. | |
*/ | |
readGlobalVariableWithNamespace(key: string, onSuccess: (value: string) => void, onError: () => void, namespace: string): void; | |
/** | |
* Sets the value for a global variable. | |
* | |
* @param key The name of the variable that will be written to. | |
* @param value The new value of the variable. | |
*/ | |
writeGlobalVariable(key: string, value: string): void; | |
/** | |
* Sets the value for a global variable in a given namespace. | |
* | |
* @param key The name of the variable that will be written to. | |
* @param value The new value of the variable. | |
* @param namespace The namespace of the global variable that will be written to. | |
*/ | |
writeGlobalVariableWithNamespace(key: string, value: string, namespace: string): void; | |
//================ Masterdata handling ============================================================================= | |
/** | |
* Executes query masterdata MEL function and return the result | |
* | |
* @param pool MD Pool - make sure this is obtained from MEL ($global:mdPool = $masterdata:poolId) | |
* @param group MD Group | |
* @param filter Array/table specifying the filter condition | |
* @param returnSpec Array/table specifying the return specification | |
* @param successCB success callback | |
* @param errorCB error callback | |
* @return Array with results | |
*/ | |
queryMasterData(pool, group, filter, returnSpec, successCB, errorCB); | |
//================ Documents handling ============================================================================== | |
/** | |
* Calls MEL method listDocument, which returns key/value hashtable containing documentKey/documentName | |
* | |
* @param pool PoolID (note that this id should be passed to JS via global variable and assignment of $document:pool) | |
* @param successCB success callback | |
* @param errorCB error callback | |
* @return Hashtable with document keys/document names | |
*/ | |
listDocument(pool, successCB, errorCB); | |
/** | |
* Calls MEL method getDocument, which returns file location of the document on the local file system | |
* | |
* @param pool PoolID (note that this id should be passed to JS via global variable and assignment of $document:pool) | |
* @param docKey Document key | |
* @param successCB success callback | |
* @param errorCB error callback | |
* @return String with document file location | |
*/ | |
getDocument(pool, docKey, successCB, errorCB); | |
//================ Container handling ============================================================================== | |
/** | |
* Calls MEL method listContainerNames | |
* | |
* @param namePrefix Prefix to be used for filtering. | |
* @param successCB success callback | |
* @param errorCB error callback | |
* @return Array with strings | |
*/ | |
listContainerNames(namePrefix, successCB, errorCB); | |
/** | |
* Call MEL method to write container | |
* @param name Name of the container | |
* @param value MEL object to be written | |
* @param replicPriority Replication priority | |
*/ | |
writeContainer(name, value, replicPriority); | |
/** | |
* Call MEL method to read container | |
* | |
* @param name Name of the container | |
* @param successCB Callback function to be called for return value | |
* @param errorCB Error callback function - when some error occurs | |
*/ | |
readContainer(name, successCB, errorCB); | |
//================ Online container handling ======================================================================= | |
/** | |
* Call MEL method to write online container | |
* | |
* @param name Name of the online container | |
* @param value MEL object to be written | |
*/ | |
writeOnlineContainer(name, value); | |
/** | |
* Call MEL method to read online container | |
* | |
* @param name Name of the online container | |
* @param successCB Callback function to be called for return value | |
* @param errorCB Error callback function - when some error occurs | |
*/ | |
readOnlineContainer(name, successCB, errorCB); | |
/** | |
* Executes triggerOnlineSync MEL procedure. Note that this does not trigger online sync, | |
* rather than raise a flag to trigger sync on screen transition | |
*/ | |
triggerOnlineSync(); | |
/** | |
* Triggers OK Event on user interface. Particularly useful when Cordova screen is set to Full screen | |
*/ | |
triggerOKEvent(); | |
/** | |
* Triggers Back Event on user interface. Particularly useful when Cordova screen is set to Full screen | |
*/ | |
triggerBackEvent(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment