UNPKG

pi-sdk

Version:

Pay Insights SDK

26 lines (21 loc) 912 B
import {ipcRenderer} from "electron" import * as Contracts from "pi-contracts" import {SDKProxyMessages} from "./SDKProxyMessages" export * from "pi-contracts" export * from "./SDKProxyMessages" export class PISDK { Initialize(appId: string, appSecret: string, region: Contracts.PIRegion, environment: Contracts.PIEnvironment): Promise<string> { return new Promise((resolve, reject) => { ipcRenderer.once(SDKProxyMessages.Initialize, (event: Electron.IpcRendererEvent, response:any) => { if (response === Contracts.PIException) { reject(response as Contracts.PIException); } else { resolve(response as string); } }); ipcRenderer.send(SDKProxyMessages.Initialize, appId, appSecret, region, environment); }); } }