nss-superapp-libs
v1.0.16
Published
Library for nss mini app to communication with super app
Downloads
93
Readme
React Support
SuperApp.setReactSupport();
Intial(In root container)
SuperApp.loadedEventListener = () =>{
SuperApp.initial("[mykey]");
/* Action with SuperApp after this */
}
MiniApp
MiniAppA -> miniAppB SuperApp.MiniApp.open(miniAppId,miniAppVersion,data) //Ex miniAppId = 'sale' ,miniAppVersion = 0 (<1 = latest version),data = "{"barcode":"12345678"}" //* use location:miniAppA
SuperApp.MiniApp.getData():String //return "{"barcode":"12345678"}" //* use location:miniAppB
SuperApp.MiniApp.finish(data) //Ex data = "{"result":"success"}" //* use location:miniAppB
SuperApp.MiniApp.callbackEventListener = function(miniAppId,data) //Ex data = "{"result":"success"}" //* use location:miniAppA
SuperApp.MiniApp.broadcastEventListener = function(data){} //Ex data = "{"data":"somedata"}" //* use location:miniAppB
SQLite Database
SuperApp.MiniApp.execSQLCommand(databaseName,command)
//Ex databaseName = 'sample.db',command = 'select * from sample limit 1'
CashDrawer
SuperApp.Device.CashDrawer.open(123456)
SuperApp.Device.CashDrawer.setCashDrawerEventListener((action,requestId)=>{})
Printer
SuperApp.Device.Printer.print(data,(action)=>{})
Customer Display
SuperApp.MiniApp.showOnCustomerDisplay(miniAppId:string,htmlPath:string,displayIndex:CustomerDisplayIndex,flag:CustomerDisplayFlag)
//Ex. miniAppId = self ,htmlPath = index.html?p=1,displayIndex = CustomerDisplayIndex.DISPLAY_INDEX_LEFT,flag=CustomerDisplayFlag.FLAG_MODE_USE_CURRENT
SuperApp.MiniApp.setCustomerDisplayFlag(flag:CustomerDisplayFlag)
//Ex.flag=CustomerDisplayFlag.FLAG_MODE_FULL
SuperApp.MiniApp.broadcastDataToCustomerDisplay(data:string,displayIndex:CustomerDisplayIndex)
SuperApp.MiniApp.broadcastDataToMiniApp(data:string)