2019-09-07 04:23:15 +00:00
|
|
|
declare global {
|
2020-06-20 08:38:14 +00:00
|
|
|
const __FILE__: string
|
|
|
|
const __LINE__: number
|
|
|
|
const __DIR__: string
|
|
|
|
const Packages: any
|
2019-09-19 11:00:35 +00:00
|
|
|
|
2020-06-20 08:38:14 +00:00
|
|
|
function print(...message: any[]): void
|
|
|
|
function load(script: string | object)
|
|
|
|
function loadWithNewGlobal(script: string | object)
|
|
|
|
function exit(code?: number)
|
|
|
|
function quit(code?: number)
|
|
|
|
function JavaImporter(...className: string[])
|
2019-09-19 11:00:35 +00:00
|
|
|
|
2019-09-07 04:23:15 +00:00
|
|
|
namespace Java {
|
2020-06-20 08:38:14 +00:00
|
|
|
function type<T = any>(clazz: string): T
|
2020-06-22 02:44:17 +00:00
|
|
|
function from<T = any>(javaObj: T[]): T[]
|
|
|
|
function to<T = any>(array: T[], type?: T): T[]
|
2020-06-20 08:38:14 +00:00
|
|
|
function extend(...parentTypes: any[]): any
|
|
|
|
function synchronized(func: () => void, lock: any): Function
|
2020-10-02 10:48:37 +00:00
|
|
|
function isJavaObject(obj: any): boolean
|
2020-06-20 08:38:14 +00:00
|
|
|
function asJSONCompatible<T = any>(obj: T): T
|
2019-09-19 11:00:35 +00:00
|
|
|
//@ts-ignore
|
|
|
|
// function super(type: any);
|
|
|
|
}
|
|
|
|
|
|
|
|
interface Error {
|
2020-06-20 08:38:14 +00:00
|
|
|
readonly class?: any
|
|
|
|
readonly lineNumber?: number
|
|
|
|
readonly columnNumber?: number
|
|
|
|
readonly fileName?: string
|
|
|
|
dumpStack?: Function
|
|
|
|
printStackTrace?: Function
|
|
|
|
getStackTrace?: () => any[]
|
2019-09-19 11:00:35 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
interface String {
|
2020-06-20 08:38:14 +00:00
|
|
|
trimLeft(): string
|
|
|
|
trimRight(): string
|
2019-09-19 11:00:35 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
interface Object {
|
2020-06-20 08:38:14 +00:00
|
|
|
setPrototypeOf(obj: object, prototype: object): void
|
|
|
|
bindProperties(to: object, from: object): void
|
2019-09-07 04:23:15 +00:00
|
|
|
}
|
2020-03-01 12:28:16 +00:00
|
|
|
|
|
|
|
namespace NodeJS {
|
|
|
|
interface Global {
|
2020-06-20 08:38:14 +00:00
|
|
|
scope: string
|
|
|
|
logger: any
|
|
|
|
debug: boolean
|
2022-05-21 03:54:40 +00:00
|
|
|
/**
|
|
|
|
* 引擎日志等级
|
|
|
|
*/
|
|
|
|
ScriptEngineLoggerLevel: string
|
2022-04-24 16:41:11 +00:00
|
|
|
/**
|
|
|
|
* 引擎配置
|
|
|
|
*/
|
|
|
|
ScriptEngineConfig: any
|
|
|
|
/**
|
|
|
|
* 引擎版本
|
|
|
|
*/
|
2020-09-22 09:33:59 +00:00
|
|
|
ScriptEngineVersion: string
|
2022-04-24 16:41:11 +00:00
|
|
|
/**
|
|
|
|
* 引擎渠道
|
|
|
|
*/
|
|
|
|
ScriptEngineChannel: string
|
2022-11-22 09:35:13 +00:00
|
|
|
/**
|
|
|
|
* 慢执行检测时间
|
|
|
|
*/
|
2022-04-01 09:18:32 +00:00
|
|
|
ScriptSlowExecuteTime: number
|
2020-09-22 09:33:59 +00:00
|
|
|
ScriptEngineStartTime: number
|
2022-11-22 09:35:13 +00:00
|
|
|
/**
|
|
|
|
* 设置全局对象
|
|
|
|
* @param key 对象名称
|
|
|
|
* @param value 对象值
|
|
|
|
* @param config 对象属性
|
|
|
|
* @returns
|
|
|
|
*/
|
2020-06-20 08:38:14 +00:00
|
|
|
setGlobal: (key: string, value: any, config?: PropertyDescriptor & ThisType<any>) => void
|
|
|
|
noop: () => void
|
|
|
|
console: Console
|
|
|
|
}
|
|
|
|
interface Process {
|
|
|
|
on(event: string, listener: any): this
|
|
|
|
emit(event: string, ...message: any): this
|
2020-03-01 12:28:16 +00:00
|
|
|
}
|
|
|
|
}
|
2020-06-20 08:38:14 +00:00
|
|
|
const root: string
|
|
|
|
const base: Core
|
|
|
|
const ScriptEngineContextHolder: any
|
|
|
|
function engineLoad(str: string | { script: string, name: string }): any
|
2020-03-01 12:28:16 +00:00
|
|
|
interface Core {
|
2022-04-01 09:18:32 +00:00
|
|
|
version: string
|
2020-06-20 08:38:14 +00:00
|
|
|
getClass(name: String): any
|
|
|
|
getProxyClass(): any
|
2020-11-20 02:28:30 +00:00
|
|
|
getJavaScriptTaskClass(): any
|
2020-06-20 08:38:14 +00:00
|
|
|
getInstance(): any
|
2022-04-24 16:41:11 +00:00
|
|
|
loadMavenDepend(groupId: string, artifactId: string, version: string): [any, any]
|
2020-06-20 08:38:14 +00:00
|
|
|
read(path: string): string
|
|
|
|
save(path: string, content: string): void
|
|
|
|
delete(path: string): void
|
2020-03-01 12:28:16 +00:00
|
|
|
}
|
|
|
|
interface Console {
|
2020-12-07 03:12:49 +00:00
|
|
|
prefix: string
|
2020-06-20 08:38:14 +00:00
|
|
|
ex(err: Error): void
|
|
|
|
stack(err: Error, color?: boolean): string[]
|
2020-07-23 05:44:39 +00:00
|
|
|
sender(sender: any, ...args: any): void
|
2020-06-20 08:38:14 +00:00
|
|
|
sender(...args: any): void
|
|
|
|
console(...args: any): void
|
|
|
|
i18n(name: string, ...params: any[]): void
|
2020-03-01 12:28:16 +00:00
|
|
|
}
|
2020-05-13 10:41:05 +00:00
|
|
|
interface ProxyConstructor {
|
2020-10-13 01:24:58 +00:00
|
|
|
newProxy<T extends object>(target: T, handler: ProxyHandle<T>): T
|
2020-05-13 10:41:05 +00:00
|
|
|
}
|
2019-09-07 04:23:15 +00:00
|
|
|
}
|
2020-10-13 01:24:58 +00:00
|
|
|
export interface ProxyHandle<T = any> extends ProxyHandler<any> {
|
|
|
|
setPrototypeOf?(target: T, v: any): any
|
|
|
|
// get: (target: any, name: string) => any
|
|
|
|
// set: (target: any, name: string, value: any) => boolean
|
|
|
|
// construct: (target: any, ...args: any[]) => any
|
|
|
|
// has: (target: any, name: string) => boolean
|
|
|
|
// ownKeys: (target: any) => string[]
|
|
|
|
values?: (target: T) => any[]
|
|
|
|
// call: (target: any, name: string, ...args: any[]) => any
|
|
|
|
// deleteProperty: (target: any, name: string) => boolean
|
|
|
|
}
|
2020-06-20 08:38:14 +00:00
|
|
|
export { }
|