@awayfl/avm1
Version:
Virtual machine for executing AS1 and AS2 code
37 lines (36 loc) • 1.33 kB
JavaScript
import { __extends } from "tslib";
import { AVM1Object } from './AVM1Object';
/**
* Base class for ActionsScript functions.
*/
var AVM1Function = /** @class */ (function (_super) {
__extends(AVM1Function, _super);
function AVM1Function(context) {
var _this = _super.call(this, context) || this;
_this.alPrototype = context.builtins.Function.alGetPrototypeProperty();
_this.isOnEnter = false;
return _this;
}
AVM1Function.prototype.alConstruct = function (args) {
throw new Error('not implemented AVM1Function.alConstruct');
};
AVM1Function.prototype.alCall = function (thisArg, args) {
throw new Error('not implemented AVM1Function.alCall');
};
/**
* Wraps the function to the callable JavaScript function.
* @returns {Function} a JavaScript function.
*/
AVM1Function.prototype.toJSFunction = function (thisArg) {
if (thisArg === void 0) { thisArg = null; }
var fn = this;
var context = this.context;
return function () {
/* eslint-disable-next-line prefer-rest-params */
var args = Array.prototype.slice.call(arguments, 0);
return context.executeFunction(fn, thisArg, args);
};
};
return AVM1Function;
}(AVM1Object));
export { AVM1Function };