MCPcopy Create free account
hub / github.com/bigskysoftware/_hyperscript / install

Method install

www/js/_hyperscript-max.js:9508–9551  ·  view source on GitHub ↗
(target, source, funcArgs, runtime2)

Source from the content-addressed store, hash-verified

9506 this.nameVal = nameVal;
9507 }
9508 install(target, source, funcArgs, runtime2) {
9509 const args = this.args;
9510 const start = this.start;
9511 const errorHandler = this.errorHandler;
9512 const errorSymbol = this.errorSymbol;
9513 const finallyHandler = this.finallyHandler;
9514 const nameVal = this.nameVal;
9515 const nameSpace = this.nameSpace;
9516 const funcName = this.name;
9517 const functionFeature = this;
9518 var func = function() {
9519 var ctx = runtime2.makeContext(source, functionFeature, target, null);
9520 ctx.meta.errorHandler = errorHandler;
9521 ctx.meta.errorSymbol = errorSymbol;
9522 ctx.meta.finallyHandler = finallyHandler;
9523 for (var i = 0; i < args.length; i++) {
9524 var name = args[i];
9525 var argumentVal = arguments[i];
9526 if (name) {
9527 ctx.locals[name.value] = argumentVal;
9528 }
9529 }
9530 ctx.meta.caller = arguments[args.length];
9531 if (ctx.meta.caller) {
9532 ctx.meta.callingCommand = ctx.meta.caller.meta.command;
9533 }
9534 var resolve, reject;
9535 var promise = new Promise(function(theResolve, theReject) {
9536 resolve = theResolve;
9537 reject = theReject;
9538 });
9539 start.execute(ctx);
9540 if (ctx.meta.returned) {
9541 return ctx.meta.returnValue;
9542 } else {
9543 ctx.meta.resolve = resolve;
9544 ctx.meta.reject = reject;
9545 return promise;
9546 }
9547 };
9548 func.hyperfunc = true;
9549 func.hypername = nameVal;
9550 runtime2.assignToNamespace(target, nameSpace, funcName, func);
9551 }
9552 static parse(parser) {
9553 if (!parser.matchToken("def")) return;
9554 var functionName = parser.requireElement("dotOrColonPath");

Callers

nothing calls this directly

Calls 1

assignToNamespaceMethod · 0.45

Tested by

no test coverage detected