mathjslab
Version:
MathJSLab - An interpreter with language syntax like MATLAB®/Octave, ISBN 978-65-00-82338-7.
70 lines (69 loc) • 2.33 kB
TypeScript
import type { RuntimeExpressionValue } from './AST';
import type { ClassInstance } from './ClassInstance';
import type { RuntimeDisplay } from './RuntimeDisplay';
/**
* Runtime value compatible with MATLAB's `event.EventData` shape.
*/
declare class ClassEventData {
/** Runtime type tag used by interpreter predicates. */
static readonly CLASS_EVENT_DATA = 12;
/** Runtime type tag stored on event data objects. */
readonly type: number;
/** Optional AST-style parent pointer used by generic value handling. */
parent?: unknown;
/** Object that raised the event. */
readonly source: ClassInstance;
/** Name of the event that was raised. */
readonly eventName: string;
/**
* Test whether a value is event data.
*
* @param obj Value to test.
* @returns `true` when `obj` is a `ClassEventData`.
*/
static readonly isInstanceOf: (obj: unknown) => obj is ClassEventData;
/**
* Create event data.
*
* @param source Object that raised the event.
* @param eventName Event name.
*/
constructor(source: ClassInstance, eventName: string);
/**
* Create event data.
*
* @param source Object that raised the event.
* @param eventName Event name.
* @returns Runtime event data object.
*/
static readonly create: (source: ClassInstance, eventName: string) => ClassEventData;
/**
* Read a public event data field.
*
* @param eventData Event data object.
* @param field Field name.
* @returns Field value, if supported.
*/
static readonly getProperty: (eventData: ClassEventData, field: string) => RuntimeExpressionValue | undefined;
/**
* Render a compact event data summary.
*
* @param eventData Event data object.
* @param _interpreter Interpreter requesting unparse.
* @returns Human-readable event data summary.
*/
static readonly unparse: (eventData: ClassEventData, _interpreter: RuntimeDisplay) => string;
/**
* Copy event data.
*
* Event data objects are immutable in the current runtime.
*
* @returns This event data object.
*/
copy(): ClassEventData;
}
export { ClassEventData };
declare const _default: {
ClassEventData: typeof ClassEventData;
};
export default _default;