mirror of
https://github.com/KAMKEEL/CustomNPC-Plus.git
synced 2026-11-20 04:09:57 +00:00
Properly static'd and final'd ES5.1 globals
This commit is contained in:
1 parent
ff5626530e
commit
ca7602098f
7 files changed
+64
-64
No files matched your search
Vendored
+1
-1
@@ -55,7 +55,7 @@
|
||||
*/
|
||||
export interface Array {
|
||||
/** Returns true if the given object is an array, false otherwise */
|
||||
isArray(arg: any): boolean;
|
||||
static isArray(arg: any): boolean;
|
||||
|
||||
/** The number of elements in the array */
|
||||
length: number;
|
||||
|
||||
Vendored
+3
-3
@@ -29,13 +29,13 @@
|
||||
*/
|
||||
export interface Date {
|
||||
/** Returns the current time as the number of milliseconds since 1970-01-01 00:00:00 UTC */
|
||||
now(): number;
|
||||
static now(): number;
|
||||
|
||||
/** Parses a date string and returns the number of milliseconds since 1970-01-01 00:00:00 UTC */
|
||||
parse(s: string): number;
|
||||
static parse(s: string): number;
|
||||
|
||||
/** Returns the number of milliseconds since 1970-01-01 00:00:00 UTC for the given UTC date/time components */
|
||||
UTC(year: number, month: number, date: number, hours: number, minutes: number, seconds: number, ms: number): number;
|
||||
static UTC(year: number, month: number, date: number, hours: number, minutes: number, seconds: number, ms: number): number;
|
||||
|
||||
/** Returns the day of the month (1-31) in local time */
|
||||
getDate(): number;
|
||||
|
||||
+10
-10
@@ -44,32 +44,32 @@
|
||||
*/
|
||||
export interface GlobalFunctions {
|
||||
/** Evaluates JavaScript code in a string (use with caution - slow and potential security issues) */
|
||||
eval(x: any): any;
|
||||
static eval(x: any): any;
|
||||
|
||||
/** Parses a string and returns an integer. Stops parsing at the first non-digit character */
|
||||
parseInt(string: string): number;
|
||||
static parseInt(string: string): number;
|
||||
|
||||
/** Parses a string and returns an integer using the specified radix (base). Stops parsing at the first non-digit character */
|
||||
parseInt(string: string, radix: number): number;
|
||||
static parseInt(string: string, radix: number): number;
|
||||
|
||||
/** Parses a string and returns a floating-point number. Stops parsing at the first invalid character */
|
||||
parseFloat(string: string): number;
|
||||
static parseFloat(string: string): number;
|
||||
|
||||
/** Determines whether a value is NaN (not-a-number). The value is first coerced to a number before testing */
|
||||
isNaN(value: any): boolean;
|
||||
static isNaN(value: any): boolean;
|
||||
|
||||
/** Determines whether a value is a finite number. The value is first coerced to a number. Returns false for Infinity, -Infinity, and NaN */
|
||||
isFinite(value: any): boolean;
|
||||
static isFinite(value: any): boolean;
|
||||
|
||||
/** Decodes a URI by replacing encoded sequences like %20 with their original characters */
|
||||
decodeURI(encodedURI: string): string;
|
||||
static decodeURI(encodedURI: string): string;
|
||||
|
||||
/** Decodes URI component by replacing ALL encoded sequences including those for reserved URI characters */
|
||||
decodeURIComponent(encodedURIComponent: string): string;
|
||||
static decodeURIComponent(encodedURIComponent: string): string;
|
||||
|
||||
/** Encodes a URI by replacing special characters with %HH sequences (but preserves reserved characters like / : ?) */
|
||||
encodeURI(uri: string): string;
|
||||
static encodeURI(uri: string): string;
|
||||
|
||||
/** Encodes URI component by replacing ALL special characters including reserved ones with %HH sequences */
|
||||
encodeURIComponent(uriComponent: string): string;
|
||||
static encodeURIComponent(uriComponent: string): string;
|
||||
}
|
||||
Vendored
+6
-6
@@ -54,7 +54,7 @@ export interface JSON {
|
||||
* @param text - A valid JSON string to parse
|
||||
* @returns The parsed JavaScript value
|
||||
*/
|
||||
parse(text: string): any;
|
||||
static parse(text: string): any;
|
||||
|
||||
/**
|
||||
* Parses a JSON string with a reviver function that transforms each parsed key-value pair.
|
||||
@@ -62,14 +62,14 @@ export interface JSON {
|
||||
* @param reviver - Function called for each key-value pair; receives the key and parsed value, returns the transformed value
|
||||
* @returns The parsed JavaScript value after applying the reviver
|
||||
*/
|
||||
parse(text: string, reviver: Java.java.util.function.BiFunction<string, any, any>): any;
|
||||
static parse(text: string, reviver: Java.java.util.function.BiFunction<string, any, any>): any;
|
||||
|
||||
/**
|
||||
* Converts a JavaScript value to a JSON string.
|
||||
* @param value - The value to serialize (object, array, string, number, boolean, or null)
|
||||
* @returns A JSON-formatted string representation of the value
|
||||
*/
|
||||
stringify(value: any): string;
|
||||
static stringify(value: any): string;
|
||||
|
||||
/**
|
||||
* Converts a JavaScript value to a JSON string, using a replacer function to filter or transform properties.
|
||||
@@ -78,7 +78,7 @@ export interface JSON {
|
||||
* @param space - Optional indentation: a number of spaces (up to 10), or a string prefix per level
|
||||
* @returns A JSON-formatted string representation of the value
|
||||
*/
|
||||
stringify(value: any, replacer: Java.java.util.function.BiFunction<string, any, any>, space?: any): string;
|
||||
static stringify(value: any, replacer: Java.java.util.function.BiFunction<string, any, any>, space?: any): string;
|
||||
|
||||
/**
|
||||
* Converts a JavaScript value to a JSON string, including only the specified properties.
|
||||
@@ -87,7 +87,7 @@ export interface JSON {
|
||||
* @param space - Optional indentation: a number of spaces (up to 10), or a string prefix per level
|
||||
* @returns A JSON-formatted string representation of the value
|
||||
*/
|
||||
stringify(value: any, replacer: string[], space?: any): string;
|
||||
static stringify(value: any, replacer: string[], space?: any): string;
|
||||
|
||||
/**
|
||||
* Converts a JavaScript value to a JSON string with optional pretty-printing.
|
||||
@@ -96,5 +96,5 @@ export interface JSON {
|
||||
* @param space - Indentation: a number of spaces (up to 10), or a string prefix per level
|
||||
* @returns A JSON-formatted string representation of the value
|
||||
*/
|
||||
stringify(value: any, replacer: null, space: any): string;
|
||||
static stringify(value: any, replacer: null, space: any): string;
|
||||
}
|
||||
Vendored
+26
-26
@@ -49,80 +49,80 @@
|
||||
*/
|
||||
export interface Math {
|
||||
/** Euler's number (~2.718), the base of natural logarithms */
|
||||
E: number;
|
||||
static readonly E: number;
|
||||
|
||||
/** Natural logarithm of 2 (~0.693) */
|
||||
LN2: number;
|
||||
static readonly LN2: number;
|
||||
|
||||
/** Natural logarithm of 10 (~2.303) */
|
||||
LN10: number;
|
||||
static readonly LN10: number;
|
||||
|
||||
/** Base-2 logarithm of e (~1.443) */
|
||||
LOG2E: number;
|
||||
static readonly LOG2E: number;
|
||||
|
||||
/** Base-10 logarithm of e (~0.434) */
|
||||
LOG10E: number;
|
||||
static readonly LOG10E: number;
|
||||
|
||||
/** Ratio of a circle's circumference to its diameter (~3.14159) */
|
||||
PI: number;
|
||||
static readonly PI: number;
|
||||
|
||||
/** Square root of 0.5 (~0.707) */
|
||||
SQRT1_2: number;
|
||||
static readonly SQRT1_2: number;
|
||||
|
||||
/** Square root of 2 (~1.414) */
|
||||
SQRT2: number;
|
||||
static readonly SQRT2: number;
|
||||
|
||||
/** Returns the absolute value of a number */
|
||||
abs(x: number): number;
|
||||
static abs(x: number): number;
|
||||
|
||||
/** Returns the arccosine (in radians) of a number */
|
||||
acos(x: number): number;
|
||||
static acos(x: number): number;
|
||||
|
||||
/** Returns the arcsine (in radians) of a number */
|
||||
asin(x: number): number;
|
||||
static asin(x: number): number;
|
||||
|
||||
/** Returns the arctangent (in radians) of a number */
|
||||
atan(x: number): number;
|
||||
static atan(x: number): number;
|
||||
|
||||
/** Returns the arctangent of two numbers (y/x), with proper quadrant handling */
|
||||
atan2(y: number, x: number): number;
|
||||
static atan2(y: number, x: number): number;
|
||||
|
||||
/** Returns the smallest integer greater than or equal to a number */
|
||||
ceil(x: number): number;
|
||||
static ceil(x: number): number;
|
||||
|
||||
/** Returns the cosine (in radians) of a number */
|
||||
cos(x: number): number;
|
||||
static cos(x: number): number;
|
||||
|
||||
/** Returns e raised to the power of a number */
|
||||
exp(x: number): number;
|
||||
static exp(x: number): number;
|
||||
|
||||
/** Returns the largest integer less than or equal to a number */
|
||||
floor(x: number): number;
|
||||
static floor(x: number): number;
|
||||
|
||||
/** Returns the natural logarithm (base e) of a number */
|
||||
log(x: number): number;
|
||||
static log(x: number): number;
|
||||
|
||||
/** Returns the largest of zero or more numbers */
|
||||
max(...values: number): number;
|
||||
static max(...values: number): number;
|
||||
|
||||
/** Returns the smallest of zero or more numbers */
|
||||
min(...values: number): number;
|
||||
static min(...values: number): number;
|
||||
|
||||
/** Returns base raised to the power of exponent */
|
||||
pow(x: number, y: number): number;
|
||||
static pow(x: number, y: number): number;
|
||||
|
||||
/** Returns a random number between 0 (inclusive) and 1 (exclusive) */
|
||||
random(): number;
|
||||
static random(): number;
|
||||
|
||||
/** Returns the value of a number rounded to the nearest integer */
|
||||
round(x: number): number;
|
||||
static round(x: number): number;
|
||||
|
||||
/** Returns the sine (in radians) of a number */
|
||||
sin(x: number): number;
|
||||
static sin(x: number): number;
|
||||
|
||||
/** Returns the square root of a number */
|
||||
sqrt(x: number): number;
|
||||
static sqrt(x: number): number;
|
||||
|
||||
/** Returns the tangent (in radians) of a number */
|
||||
tan(x: number): number;
|
||||
static tan(x: number): number;
|
||||
}
|
||||
Vendored
+5
-5
@@ -40,19 +40,19 @@
|
||||
*/
|
||||
export interface Number {
|
||||
/** The largest representable number (~1.79e+308) */
|
||||
MAX_VALUE: number;
|
||||
static readonly MAX_VALUE: number;
|
||||
|
||||
/** The smallest representable positive number (~5e-324) */
|
||||
MIN_VALUE: number;
|
||||
static readonly MIN_VALUE: number;
|
||||
|
||||
/** Represents "Not a Number" (NaN) - the result of undefined or invalid arithmetic operations */
|
||||
NaN: number;
|
||||
static readonly NaN: number;
|
||||
|
||||
/** Represents negative infinity, the result of overflow or division by zero */
|
||||
NEGATIVE_INFINITY: number;
|
||||
static readonly NEGATIVE_INFINITY: number;
|
||||
|
||||
/** Represents positive infinity, the result of overflow or division by zero */
|
||||
POSITIVE_INFINITY: number;
|
||||
static readonly POSITIVE_INFINITY: number;
|
||||
|
||||
/** Formats the number using exponential notation with optional fractional digits */
|
||||
toExponential(fractionDigits: number): string;
|
||||
|
||||
Vendored
+13
-13
@@ -52,43 +52,43 @@
|
||||
*/
|
||||
export interface Object {
|
||||
/** Creates a new object with the specified prototype and optional property descriptors */
|
||||
create(proto: any, propertiesObject: any): any;
|
||||
static create(proto: any, propertiesObject: any): any;
|
||||
|
||||
/** Defines or modifies multiple properties on an object and returns the modified object */
|
||||
defineProperties(obj: any, props: any): any;
|
||||
static defineProperties(obj: any, props: any): any;
|
||||
|
||||
/** Defines a new property on an object or modifies an existing property and returns the object */
|
||||
defineProperty(obj: any, prop: string, descriptor: any): any;
|
||||
static defineProperty(obj: any, prop: string, descriptor: any): any;
|
||||
|
||||
/** Prevents all modifications to an object (cannot add, modify, or delete properties) */
|
||||
freeze(obj: any): any;
|
||||
static freeze(obj: any): any;
|
||||
|
||||
/** Returns a property descriptor for a named property on an object, or undefined if not found */
|
||||
getOwnPropertyDescriptor(obj: any, prop: string): any;
|
||||
static getOwnPropertyDescriptor(obj: any, prop: string): any;
|
||||
|
||||
/** Returns an array of all property names (both enumerable and non-enumerable) on an object */
|
||||
getOwnPropertyNames(obj: any): string[];
|
||||
static getOwnPropertyNames(obj: any): string[];
|
||||
|
||||
/** Returns the prototype object of the specified object */
|
||||
getPrototypeOf(obj: any): any;
|
||||
static getPrototypeOf(obj: any): any;
|
||||
|
||||
/** Determines whether an object is extensible (can have new properties added to it) */
|
||||
isExtensible(obj: any): boolean;
|
||||
static isExtensible(obj: any): boolean;
|
||||
|
||||
/** Determines whether an object has been frozen (is immutable) */
|
||||
isFrozen(obj: any): boolean;
|
||||
static isFrozen(obj: any): boolean;
|
||||
|
||||
/** Determines whether an object is sealed (cannot add or delete properties) */
|
||||
isSealed(obj: any): boolean;
|
||||
static isSealed(obj: any): boolean;
|
||||
|
||||
/** Returns an array of all enumerable property names on an object */
|
||||
keys(obj: any): string[];
|
||||
static keys(obj: any): string[];
|
||||
|
||||
/** Prevents new properties from being added to an object but allows modification of existing ones */
|
||||
preventExtensions(obj: any): any;
|
||||
static preventExtensions(obj: any): any;
|
||||
|
||||
/** Prevents all modifications to an object except for reading and writing property values */
|
||||
seal(obj: any): any;
|
||||
static seal(obj: any): any;
|
||||
|
||||
/** Determines whether an object has a property with the specified name (direct property, not inherited) */
|
||||
hasOwnProperty(prop: string): boolean;
|
||||
|
||||
Reference in new issue
Block a user