UNPKG

@kvaser/canking-api

Version:

CanKing API to communicate with the CanKing service using Node.js.

273 lines (272 loc) 9.09 kB
var p = Object.defineProperty; var g = (r, e, s) => e in r ? p(r, e, { enumerable: !0, configurable: !0, writable: !0, value: s }) : r[e] = s; var t = (r, e, s) => g(r, typeof e != "symbol" ? e + "" : e, s); import "long"; import { aI as d } from "./measurement_settings.mjs"; class v { /** * Creates a new IpcRendererFake. */ constructor(e) { t(this, "userSettings"); this.userSettings = e; } /** * Listens to `channel`, when a new message arrives `listener` would be called with * `listener(event, args...)`. */ on(e, s) { return () => { }; } /** * Adds a one time `listener` function for the event. This `listener` is invoked * only the next time a message is sent to `channel`, after which it is removed. */ once(e, s) { return () => { }; } /** * Removes all listeners, or those of the specified `channel`. */ removeAllListeners(e) { } /** * Removes the specified `listener` from the listener array for the specified * `channel`. * * @deprecated Use `on` listen return instead * */ removeListener(e, s) { return this; } /** * Send an asynchronous message to the main process via `channel`, along with * arguments. Arguments will be serialized with the Structured Clone Algorithm, * just like `window.postMessage`, so prototype chains will not be included. * Sending Functions, Promises, Symbols, WeakMaps, or WeakSets will throw an * exception. * * **NOTE:** Sending non-standard JavaScript types such as DOM objects or special * Electron objects will throw an exception. * * Since the main process does not have support for DOM objects such as * `ImageBitmap`, `File`, `DOMMatrix` and so on, such objects cannot be sent over * Electron's IPC to the main process, as the main process would have no way to * decode them. Attempting to send such objects over IPC will result in an error. * * The main process handles it by listening for `channel` with the `ipcMain` * module. * * If you need to transfer a `MessagePort` to the main process, use * `ipcRenderer.postMessage`. * * If you want to receive a single response from the main process, like the result * of a method call, consider using `ipcRenderer.invoke`. */ send(e, ...s) { } /** * Resolves with the response from the main process. * * Send a message to the main process via `channel` and expect a result * asynchronously. Arguments will be serialized with the Structured Clone * Algorithm, just like `window.postMessage`, so prototype chains will not be * included. Sending Functions, Promises, Symbols, WeakMaps, or WeakSets will throw * an exception. * * **NOTE:** Sending non-standard JavaScript types such as DOM objects or special * Electron objects will throw an exception. * * Since the main process does not have support for DOM objects such as * `ImageBitmap`, `File`, `DOMMatrix` and so on, such objects cannot be sent over * Electron's IPC to the main process, as the main process would have no way to * decode them. Attempting to send such objects over IPC will result in an error. * * The main process should listen for `channel` with `ipcMain.handle()`. * * For example: * * If you need to transfer a `MessagePort` to the main process, use * `ipcRenderer.postMessage`. * * If you do not need a response to the message, consider using `ipcRenderer.send`. */ invoke(e, ...s) { switch (e) { case "rpc-get-devices": const n = []; return Promise.resolve(n); case "app-get-session-data": return Promise.resolve(null); case "app-get-user-settings": return Promise.resolve(this.userSettings); case "rpc-get-online-status": const a = { isOnline: !1 }; return Promise.resolve(a); case "rpc-get-node-statuses": const o = []; return Promise.resolve(o); case "prj-get-meas-setup": return Promise.resolve(d.create()); case "prj-get-workspaces": const c = []; return Promise.resolve(c); case "prj-get-workspace-panes": const i = []; return Promise.resolve(i); case "app-get-workspace-view-session-data": case "rpc-start-periodic-transmission": return Promise.resolve(""); case "rpc-get-message-log-file-formats": const l = []; return Promise.resolve(l); case "rpc-get-signal-log-file-formats": const m = []; return Promise.resolve(m); case "rpc-get-frame-definitions": const u = []; return Promise.resolve(u); case "mm-get-measurement-data-buffer": case "mm-get-latest-measurement-data": return Promise.resolve(frames); default: return Promise.resolve(); } } /** * Send a message to the main process, optionally transferring ownership of zero or * more `MessagePort` objects. * * The transferred `MessagePort` objects will be available in the main process as * `MessagePortMain` objects by accessing the `ports` property of the emitted * event. * * **NOTE:** Cannot transfer these when `contextIsolation: true`. * * For example: * * For more information on using `MessagePort` and `MessageChannel`, see the MDN * documentation. */ postMessage(e, s, n) { } /** * The value sent back by the `ipcMain` handler. * * Send a message to the main process via `channel` and expect a result * synchronously. Arguments will be serialized with the Structured Clone Algorithm, * just like `window.postMessage`, so prototype chains will not be included. * Sending Functions, Promises, Symbols, WeakMaps, or WeakSets will throw an * exception. * * **NOTE:** Sending non-standard JavaScript types such as DOM objects or special * Electron objects will throw an exception. * * Since the main process does not have support for DOM objects such as * `ImageBitmap`, `File`, `DOMMatrix` and so on, such objects cannot be sent over * Electron's IPC to the main process, as the main process would have no way to * decode them. Attempting to send such objects over IPC will result in an error. * * The main process handles it by listening for `channel` with `ipcMain` module, * and replies by setting `event.returnValue`. * * warning: **WARNING**: Sending a synchronous message will block the whole * renderer process until the reply is received, so use this method only as a last * resort. It's much better to use the asynchronous version, `invoke()`. */ sendSync(e, ...s) { } /** * Sends a message to a window with `webContentsId` via `channel`. * * @deprecated This methond has been removed since Electron 28. */ sendTo(e, s, ...n) { } /** * Like `ipcRenderer.send` but the event will be sent to the `<webview>` element in * the host page instead of the main process. */ sendToHost(e, ...s) { } } class f { /** * A key for the inserted CSS that can later be used to remove the CSS via * `webFrame.removeInsertedCSS(key)`. * * Injects CSS into the current web page and returns a unique key for the inserted * stylesheet. */ insertCSS(e) { return ""; } /** * Changes the zoom factor to the specified factor. Zoom factor is zoom percent * divided by 100, so 300% = 3.0. * * The factor must be greater than 0.0. */ setZoomFactor(e) { } /** * Changes the zoom level to the specified level. The original size is 0 and each * increment above or below represents zooming 20% larger or smaller to default * limits of 300% and 50% of original size, respectively. * * **NOTE**: The zoom policy at the Chromium level is same-origin, meaning that * the zoom level for a specific domain propagates across all instances of windows * with the same domain. Differentiating the window URLs will make zoom work * per-window. */ setZoomLevel(e) { } } class F { constructor() { /** * The process.platform property returns a string identifying the operating system platform * on which the Node.js process is running. */ t(this, "platform"); /** * A list of versions for the current node.js/electron configuration. */ t(this, "versions"); /** * The process.env property returns an object containing the user environment. */ t(this, "env"); } } const P = (r) => { const e = { version: "1.0.0", theme: "light", language: "en", strings: {}, showToolsPanel: !0, useHexNumericBase: !0, maxDataBytes: 16, defaultProjectFolder: "", defaultLogFilesFolder: "", defaultCANDatabasesFolder: "", defaultLINDatabasesFolder: "", currentProjectFile: "", currentProjectFileName: "", recentProjectFiles: [], closeAppServiceAction: "prompt" }; return { ipcRenderer: new v(r ?? e), webFrame: new f(), process: new F() }; }, S = P(); export { P as c, S as e };