@awayfl/avm1
Version:
Virtual machine for executing AS1 and AS2 code
92 lines • 3.98 kB
TypeScript
import { AVM1Object } from './runtime/AVM1Object';
import { AVM1Function } from './runtime/AVM1Function';
export declare const enum AVM1PropertyFlags {
DONT_ENUM = 1,
DONT_DELETE = 2,
READ_ONLY = 4,
DATA = 64,
ACCESSOR = 128,
ASSETPROP_MASK = 7
}
export declare const enum AVM1DefaultValueHint {
NUMBER = 0,
STRING = 1
}
export interface IAVM1Callable {
alCall(thisArg: any, args?: any[]): any;
}
export interface IAVM1PropertyWatcher {
name: any;
callback: IAVM1Callable;
userData: any;
}
export interface IAVM1Builtins {
Object: AVM1Object;
Function: AVM1Object;
Boolean: AVM1Object;
Number: AVM1Object;
String: AVM1Object;
Array: AVM1Object;
Date: AVM1Object;
Math: AVM1Object;
Error: AVM1Object;
}
export interface IAVM1Context {
builtins: IAVM1Builtins;
swfVersion: number;
isPropertyCaseSensitive: boolean;
registerClass(name: string, cls: AVM1Object): void;
}
/**
* Base class for ActionScript functions with native JavaScript implementation.
*/
export declare class AVM1NativeFunction extends AVM1Function {
private _fn;
private _ctor;
/**
* @param {IAVM1Context} context
* @param {Function} fn The native function for regular calling.
* @param {Function} ctor The native function for construction.
*/
constructor(context: IAVM1Context, fn: Function, ctor?: Function);
alConstruct(args?: any[]): AVM1Object;
alCall(thisArg: any, args?: any[]): any;
}
/**
* Base class the is used for the interpreter.
* See {AVM1InterpretedFunction} implementation
*/
export declare class AVM1EvalFunction extends AVM1Function {
constructor(context: IAVM1Context);
alConstruct(args?: any[]): AVM1Object;
}
export declare function alToPrimitive(context: IAVM1Context, v: any, preferredType?: AVM1DefaultValueHint): any;
export declare function bToRuntimeBool(context: IAVM1Context, v: boolean | number): boolean | number;
export declare function alToBoolean(context: IAVM1Context, v: any): boolean;
export declare function alToNumber(context: IAVM1Context, v: any): number;
export declare function alToInteger(context: IAVM1Context, v: any): number;
export declare function alToInt32(context: IAVM1Context, v: any): number;
export declare function alToString(context: IAVM1Context, v: any): string;
export declare function alIsName(context: IAVM1Context, v: any): boolean;
export declare function alToObject(context: IAVM1Context, v: any): AVM1Object;
export declare function alNewObject(context: IAVM1Context): AVM1Object;
export declare function alGetObjectClass(obj: AVM1Object): string;
/**
* Non-standard string coercion function roughly matching the behavior of AVM2's axCoerceString.
*
* This is useful when dealing with AVM2 objects in the implementation of AVM1 builtins: they
* frequently expect either a string or `null`, but not `undefined`.
*/
export declare function alCoerceString(context: IAVM1Context, x: any): string;
export declare function alCoerceNumber(context: IAVM1Context, x: any): number;
export declare function alIsIndex(context: IAVM1Context, p: any): boolean;
export declare function alForEachProperty(obj: AVM1Object, fn: (name: string) => void, thisArg?: any): void;
export declare function alIsFunction(obj: any): boolean;
export declare function alCallProperty(obj: AVM1Object, p: any, args?: any[]): any;
export declare function alInstanceOf(context: IAVM1Context, obj: any, cls: any): boolean;
export declare function alIsArray(context: IAVM1Context, v: any): boolean;
export declare function alIsArrayLike(context: IAVM1Context, v: any): boolean;
export declare function alIterateArray(context: IAVM1Context, arr: AVM1Object, fn: (obj: any, index?: number) => void, thisArg?: any): void;
export declare function alIsString(context: IAVM1Context, v: any): boolean;
export declare function alDefineObjectProperties(obj: AVM1Object, descriptors: any): void;
//# sourceMappingURL=runtime.d.ts.map