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
|
|
|
|
level: string
|
2020-09-22 09:33:59 +00:00
|
|
|
ScriptEngineVersion: string
|
|
|
|
ScriptEngineStartTime: number
|
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 {
|
2020-06-20 08:38:14 +00:00
|
|
|
getClass(name: String): any
|
|
|
|
getProxyClass(): any
|
|
|
|
getInstance(): any
|
|
|
|
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-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 { }
|