@widget-js/core 0.10.8 → 0.10.14

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.ts CHANGED
@@ -1,3 +1,4 @@
1
+ import { CPUUsage, IOCounters, BlinkMemoryInfo, HeapStatistics as HeapStatistics$1, ProcessMemoryInfo, SystemMemoryInfo } from 'electron';
1
2
  import { FileTypeResult } from 'file-type';
2
3
 
3
4
  /**
@@ -1383,7 +1384,8 @@ declare enum Channel {
1383
1384
  DEVICE = "channel::cn.widgetjs.core.device",
1384
1385
  MOUSE = "channel::cn.widgetjs.core.mouse",
1385
1386
  KEYBOARD = "channel::cn.widgetjs.core.keyboard",
1386
- STORE = "channel::cn.widgetjs.core.store"
1387
+ STORE = "channel::cn.widgetjs.core.store",
1388
+ PROCESS = "channel::cn.widgetjs.core.process"
1387
1389
  }
1388
1390
 
1389
1391
  interface IClipboardApi {
@@ -1423,6 +1425,23 @@ interface IBroadcastApi {
1423
1425
  type BroadcastApiMethods = keyof IBroadcastApi;
1424
1426
  declare const BroadcastApi: IBroadcastApi;
1425
1427
 
1428
+ interface IProcessApi {
1429
+ getCPUUsage(): Promise<CPUUsage>;
1430
+ getIOCounters(): Promise<IOCounters>;
1431
+ getBlinkMemoryInfo(): Promise<BlinkMemoryInfo>;
1432
+ getHeapStatistics(): Promise<HeapStatistics$1>;
1433
+ /**
1434
+ * // On macOS -> '10.13.6'
1435
+ * // On Windows -> '10.0.17763'
1436
+ * // On Linux -> '4.15.0-45-generic'
1437
+ */
1438
+ getSystemVersion(): Promise<string>;
1439
+ getProcessMemoryInfo(): Promise<ProcessMemoryInfo>;
1440
+ getSystemMemoryInfo(): Promise<SystemMemoryInfo>;
1441
+ }
1442
+ type ProcessApiMethods = keyof IProcessApi;
1443
+ declare const ProcessApi: IProcessApi;
1444
+
1426
1445
  interface IDialogApi {
1427
1446
  pickFile(extensions?: string[]): Promise<string | undefined>;
1428
1447
  pickFolder(): Promise<string | undefined>;
@@ -1462,4 +1481,20 @@ interface IFileApi {
1462
1481
  type FileApiMethods = keyof IFileApi;
1463
1482
  declare const FileApi: IFileApi;
1464
1483
 
1465
- export { AlignPosition, ApiConstants, AppApi, AppApiConstants, AppApiEvent, AppApiMethods, AppMouseEvent, AppNotification, BaseApi, BroadcastApi, BroadcastApiMethods, BroadcastEvent, BroadcastEventType, BrowserWindowApi, BrowserWindowApiEvent, BrowserWindowApiMethods, Channel, ClipboardApi, ClipboardApiEvent, ClipboardApiMethods, DeployMode, DeployedPage, DeployedWidget, DeployedWidgetApi, DeployedWidgetApiMethods, DevOptions, DeviceApi, DeviceApiMethods, DialogApi, DialogApiMethods, ElectronApi, ElectronUtils, FileApi, FileApiMethods, Gravity, GridRect, GridSystem, HostedMode, IGridRect, IPage, IPageOptions, IWidgetDataApi, IWidgetOptions, IWindowSize, LanguageCode, LanguageTextMap, LocalPackageUrlInfo, LocationQuery, LocationQueryRaw, LocationQueryValue, LocationQueryValueRaw, LogApi, LogApiMethods, MetaInfo, NativeKeyboardEvent, NormalizeOptions, NotificationApi, NotificationApiEvent, NotificationApiMethods, NotificationOption, NotificationSize, NotificationType, OpenUrlOptions, Page, Point, Position, ReadDirOptions, Rectangle, RemotePackageUrlInfo, SaveWidgetOption, SetPositionOptions, ShortcutApi, ShortcutApiEvent, ShortcutApiMethods, StoreApi, StoreApiMethods, ThemeMode, WebSocketEvent, WebSocketEventType, Widget, WidgetApi, WidgetApiEvent, WidgetApiMethods, WidgetData, WidgetDataApi, WidgetDataApiMethods, WidgetKeyword, WidgetPackage, WidgetPackageOptions, WidgetParams, WidgetPermission, WidgetRoute, WidgetUrlUtils, getTextByLanguageCode, normalizeUrl, parseQuery, stringifyQuery };
1484
+ /**
1485
+ * An object with V8 heap statistics. Note that all statistics are reported in Kilobytes.
1486
+ * @link https://www.electronjs.org/docs/latest/api/process#processgetheapstatistics
1487
+ */
1488
+ interface HeapStatistics {
1489
+ totalHeapSize: number;
1490
+ totalHeapSizeExecutable: number;
1491
+ totalPhysicalSize: number;
1492
+ totalAvailableSize: number;
1493
+ usedHeapSize: number;
1494
+ heapSizeLimit: number;
1495
+ mallocedMemory: number;
1496
+ peakMallocedMemory: number;
1497
+ doesZapGarbage: boolean;
1498
+ }
1499
+
1500
+ export { AlignPosition, ApiConstants, AppApi, AppApiConstants, AppApiEvent, AppApiMethods, AppMouseEvent, AppNotification, BaseApi, BroadcastApi, BroadcastApiMethods, BroadcastEvent, BroadcastEventType, BrowserWindowApi, BrowserWindowApiEvent, BrowserWindowApiMethods, Channel, ClipboardApi, ClipboardApiEvent, ClipboardApiMethods, DeployMode, DeployedPage, DeployedWidget, DeployedWidgetApi, DeployedWidgetApiMethods, DevOptions, DeviceApi, DeviceApiMethods, DialogApi, DialogApiMethods, ElectronApi, ElectronUtils, FileApi, FileApiMethods, Gravity, GridRect, GridSystem, HeapStatistics, HostedMode, IGridRect, IPage, IPageOptions, IWidgetDataApi, IWidgetOptions, IWindowSize, LanguageCode, LanguageTextMap, LocalPackageUrlInfo, LocationQuery, LocationQueryRaw, LocationQueryValue, LocationQueryValueRaw, LogApi, LogApiMethods, MetaInfo, NativeKeyboardEvent, NormalizeOptions, NotificationApi, NotificationApiEvent, NotificationApiMethods, NotificationOption, NotificationSize, NotificationType, OpenUrlOptions, Page, Point, Position, ProcessApi, ProcessApiMethods, ReadDirOptions, Rectangle, RemotePackageUrlInfo, SaveWidgetOption, SetPositionOptions, ShortcutApi, ShortcutApiEvent, ShortcutApiMethods, StoreApi, StoreApiMethods, ThemeMode, WebSocketEvent, WebSocketEventType, Widget, WidgetApi, WidgetApiEvent, WidgetApiMethods, WidgetData, WidgetDataApi, WidgetDataApiMethods, WidgetKeyword, WidgetPackage, WidgetPackageOptions, WidgetParams, WidgetPermission, WidgetRoute, WidgetUrlUtils, getTextByLanguageCode, normalizeUrl, parseQuery, stringifyQuery };
package/dist/index.js CHANGED
@@ -1158,6 +1158,7 @@ var Channel = /* @__PURE__ */ ((Channel2) => {
1158
1158
  Channel2["MOUSE"] = "channel::cn.widgetjs.core.mouse";
1159
1159
  Channel2["KEYBOARD"] = "channel::cn.widgetjs.core.keyboard";
1160
1160
  Channel2["STORE"] = "channel::cn.widgetjs.core.store";
1161
+ Channel2["PROCESS"] = "channel::cn.widgetjs.core.process";
1161
1162
  return Channel2;
1162
1163
  })(Channel || {});
1163
1164
 
@@ -1798,6 +1799,35 @@ var ShortcutApiImpl = class extends BaseApi {
1798
1799
  };
1799
1800
  var ShortcutApi = new ShortcutApiImpl();
1800
1801
 
1802
+ // src/api/ProcessApi.ts
1803
+ var ProcessApiImpl = class extends BaseApi {
1804
+ getChannel() {
1805
+ return "channel::cn.widgetjs.core.process" /* PROCESS */;
1806
+ }
1807
+ getBlinkMemoryInfo() {
1808
+ return this.invokeMethod("getBlinkMemoryInfo");
1809
+ }
1810
+ getCPUUsage() {
1811
+ return this.invokeMethod("getCPUUsage");
1812
+ }
1813
+ getHeapStatistics() {
1814
+ return this.invokeMethod("getHeapStatistics");
1815
+ }
1816
+ getIOCounters() {
1817
+ return this.invokeMethod("getIOCounters");
1818
+ }
1819
+ getProcessMemoryInfo() {
1820
+ return this.invokeMethod("getProcessMemoryInfo");
1821
+ }
1822
+ getSystemMemoryInfo() {
1823
+ return this.invokeMethod("getSystemMemoryInfo");
1824
+ }
1825
+ getSystemVersion() {
1826
+ return this.invokeMethod("getSystemVersion");
1827
+ }
1828
+ };
1829
+ var ProcessApi = new ProcessApiImpl();
1830
+
1801
1831
  // src/api/AppApi.ts
1802
1832
  var AppApiEvent = /* @__PURE__ */ ((AppApiEvent2) => {
1803
1833
  AppApiEvent2["CONFIG_CHANGED"] = "event::cn.widgetjs.core.app.config.changed";
@@ -1981,6 +2011,7 @@ export {
1981
2011
  NotificationApiEvent,
1982
2012
  NotificationSize,
1983
2013
  Page,
2014
+ ProcessApi,
1984
2015
  ShortcutApi,
1985
2016
  ShortcutApiEvent,
1986
2017
  StoreApi,