electron-re
Advanced tools
Comparing version 1.2.0 to 1.2.1
@@ -37,3 +37,3 @@ "use strict"; | ||
var compareVersion = "function compareVersion(version1, version2) {\n const v1s = String(version1).split('.');\n const v2s = String(version2).split('.');\n \n while (v1s.length || v2s.length) {\n let tmp1 = +(v1s.shift() || 0);\n let tmp2 = +(v2s.shift() || 0);\n if (tmp1 > tmp2) {\n return 1;\n }\n if (tmp1 < tmp2) {\n return -1;\n }\n }\n \n return 0;\n }"; | ||
var internalFunc = "function() {\n const baseUrl = document.querySelector('base').getAttribute('href');\n const needPolyfill = compareVersion(process.versions.electron, '14') >= 0;\n global._depends = [];\n global.$require = require;\n\n global.require = require = (function(require) {\n const _require = require;\n const remote =\n needPolyfill ?\n _require('@electron/remote') :\n _require('electron').remote;\n \n return function(_path) {\n let result;\n const path = _require('path');\n if (_path === 'electron') return {\n ...(needPolyfill ? remote.electron : remote.require('electron')),\n ..._require('electron'),\n remote: remote,\n remoteRequire: (function (name) {\n if (needPolyfill)\n return this[name];\n return this.require(name);\n }).bind(remote),\n };\n try {\n result = _require(_path);\n } catch(error) {\n result =\n _require(\n (path.posix.join(path.sep, ...(path.dirname(baseUrl.replace('file:///', ''))).split(path.sep), _path))\n );\n }\n return result;\n }\n })(require);\n }"; | ||
var internalFunc = "function() {\n const baseUrl = document.querySelector('base').getAttribute('href');\n const needPolyfill = compareVersion(process.versions.electron, '14') >= 0;\n global._depends = [];\n global.$require = require;\n\n global.require = require = (function(require) {\n const _require = require;\n const remote =\n needPolyfill ?\n _require('@electron/remote') :\n _require('electron').remote;\n const getModule = function(name) {\n return needPolyfill ? remote[name] : remote.require('electron')[name];\n };\n \n return function(_path) {\n let result;\n const path = _require('path');\n\n if (_path === 'electron') return {\n BaseWindow: getModule('BaseWindow'),\n BrowserWindow: getModule('BrowserWindow'),\n Notification: getModule('Notification'),\n BrowserView: getModule('BrowserView'),\n ImageView: getModule('ImageView'),\n Menu: getModule('Menu'),\n MenuItem: getModule('MenuItem'),\n MessageChannelMain: getModule('MessageChannelMain'),\n ShareMenu: getModule('ShareMenu'),\n TopLevelWindow: getModule('TopLevelWindow'),\n TouchBar: getModule('TouchBar'),\n Tray: getModule('Tray'),\n View: getModule('View'),\n WebContentsView: getModule('WebContentsView'),\n desktopCapturer: getModule('desktopCapturer'),\n dialog: getModule('dialog'),\n getCurrentWebContents: getModule('getCurrentWebContents'),\n getCurrentWindow: getModule('getCurrentWindow'),\n net: getModule('net'),\n netLog: getModule('netLog'),\n nativeTheme: getModule('nativeTheme'),\n nativeImage: getModule('nativeImage'),\n ipcMain: getModule('ipcMain'),\n systemPreferences: getModule('systemPreferences'),\n\n ..._require('electron'),\n remote: remote,\n remoteRequire: (function (name) {\n if (needPolyfill)\n return this[name];\n return this.require(name);\n }).bind(remote),\n };\n try {\n result = _require(_path);\n } catch(error) {\n result =\n _require(\n (path.posix.join(path.sep, ...(path.dirname(baseUrl.replace('file:///', ''))).split(path.sep), _path))\n );\n }\n return result;\n }\n })(require);\n }"; | ||
/* webview internal func2 */ | ||
@@ -40,0 +40,0 @@ |
{ | ||
"name": "electron-re", | ||
"version": "1.2.0", | ||
"version": "1.2.1", | ||
"description": "Electron Process Manager", | ||
@@ -5,0 +5,0 @@ "main": "./lib/index", |
@@ -56,3 +56,3 @@ [![GitHub license](https://img.shields.io/github/license/nojsja/electron-re)](https://github.com/nojsja/electron-re/blob/master/LICENSE.md) | ||
![architecture](http://nojsja.gitee.io/static-resources/images/electron-re/electron-re.png?v2) | ||
![architecture](http://nojsja.gitee.io/static-resources/images/electron-re/electron-re_arch.png) | ||
@@ -59,0 +59,0 @@ ### I. What can be used for? |
declare module electronReModule { | ||
export interface electronRe { | ||
MessageChannel: { | ||
invoke: (name: string, channel: string, args: unknown) => Promise<any> | ||
handle: (channel: string, promiseFunc: (event, args: { action: string, params: any }) => Promise<unknown>) => void | ||
send: (name: string, channel: string, args: unknown) => void | ||
sendTo: (id: number, channel: string, args: unknown) => void | ||
on: (channel: string, func: () => void) => void | ||
once: (channel: string, func: () => void) => void | ||
registry: (name: string, id: number, pid: number) => void | ||
export class BrowserService { | ||
constructor( | ||
name: string, | ||
path: string, | ||
options?: Electron.BrowserWindowConstructorOptions & { | ||
dev: boolean | ||
} | ||
): void | ||
openDevTools: () => void | ||
connected: (callback?: () => void) => void | ||
} | ||
export class MessageChannel { | ||
static invoke: (name: string, channel: string, args: unknown) => Promise<any> | ||
static handle: (channel: string, promiseFunc: (event, args: { action: string, params: any }) => Promise<unknown>) => void | ||
static send: (name: string, channel: string, args: unknown) => void | ||
static sendTo: (id: number, channel: string, args: unknown) => void | ||
static on: (channel: string, func: () => void) => void | ||
static once: (channel: string, func: () => void) => void | ||
static registry: (name: string, id: number, pid: number) => void | ||
} | ||
export class ChildProcessPool { | ||
constructor( | ||
params: { | ||
path: string, | ||
max: number, | ||
cwd?: string, | ||
env?: { [key: string]: string }, | ||
weights?: number[], // weights of processes, the length is equal to max | ||
strategy?: string, | ||
lifecycle?: { // lifecycle of processes | ||
expect?: number, // default timeout 10 minutes | ||
internal?: number // default loop interval 30 seconds | ||
} | ||
} | ||
): void | ||
send: (taskName: string, params?: unknown, givenId?: number) => Promise<any> | ||
sendToAll: (taskName: string, params?: unknown) => void | ||
kill: (id?: number) => void | ||
setMaxInstanceLimit: (count: number) => void | ||
} | ||
export class LoadBalancer { | ||
static ALGORITHM: { | ||
POLLING: 'POLLING', // 轮询 | ||
WEIGHTS: 'WEIGHTS', // 权重 | ||
RANDOM: 'RANDOM', // 随机 | ||
SPECIFY: 'SPECIFY', // 声明绑定 | ||
WEIGHTS_POLLING: 'WEIGHTS_POLLING', // 权重轮询 | ||
WEIGHTS_RANDOM: 'WEIGHTS_RANDOM', // 权重随机 | ||
MINIMUM_CONNECTION: 'MINIMUM_CONNECTION', // 最小连接数 | ||
WEIGHTS_MINIMUM_CONNECTION: 'WEIGHTS_MINIMUM_CONNECTION', // 权重最小连接数 | ||
} | ||
BrowserService: { | ||
openDevTools: () => void | ||
connected: (callback?: () => void) => void | ||
} | ||
ChildProcessPool: { | ||
send: (taskName: string, params: unknown, givenId: number) => Promise<any> | ||
sendToAll: (taskName: string, params: unknown) => void | ||
kill: (id?: number) => void | ||
setMaxInstanceLimit: (count: number) => void | ||
} | ||
ProcessHost: { | ||
registry: (taskName: string, processor: () => Promise<any>) => void | ||
unregistry: (taskName: string) => void | ||
disconnect: () => void | ||
exit: () => void | ||
} | ||
ProcessManager: { | ||
pipe: (pinstance: any) => void | ||
listen: (pids: number[], mark: string, url?: string) => void | ||
unlisten: (pids: number[]) => void | ||
openDevTools: (pid: number) => void | ||
killProcess: (pid: number) => void | ||
setIntervalTime: (time: number) => void | ||
openWindow: (env: 'prod' | 'dev' | void) => void | ||
} | ||
} | ||
export class ProcessHost { | ||
static registry: (taskName: string, processor: () => Promise<any>) => void | ||
static unregistry: (taskName: string) => void | ||
static disconnect: () => void | ||
static exit: () => void | ||
} | ||
export class ProcessManager { | ||
static pipe: (pinstance: any) => void | ||
static listen: (pids: number[], mark: string, url?: string) => void | ||
static unlisten: (pids: number[]) => void | ||
static openDevTools: (pid: number) => void | ||
static killProcess: (pid: number) => void | ||
static setIntervalTime: (time: number) => void | ||
static openWindow: (env: 'prod' | 'dev' | void) => void | ||
} | ||
} | ||
declare const ere: electronReModule.electronRe; | ||
export as namespace electronReModule; | ||
export = ere; | ||
export = electronReModule |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Long strings
Supply chain riskContains long string literals, which may be a sign of obfuscated or packed code.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Long strings
Supply chain riskContains long string literals, which may be a sign of obfuscated or packed code.
Found 1 instance in 1 package
1265615
41
29208