From 7c4b48c391a8f8e63a4f5ff9f0b11203bb0ae34e Mon Sep 17 00:00:00 2001 From: Avraham Sakal Date: Wed, 17 May 2023 08:53:26 -0400 Subject: [PATCH] rename variable for clarity --- src/index.ts | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/index.ts b/src/index.ts index 0159b31..506f3b7 100644 --- a/src/index.ts +++ b/src/index.ts @@ -114,21 +114,21 @@ function processEvents(interpreter:Interpreter_T){ Object.values(interpreter.subscriptions).forEach((subscriptionCallbackFunction)=>{ subscriptionCallbackFunction(interpreter); }); } function processNextEvent(interpreter:Interpreter_T){ - const nextEvent = interpreter.eventQueue.shift(); - if(typeof nextEvent !== 'undefined'){ + const event = interpreter.eventQueue.shift(); + if(typeof event !== 'undefined'){ const state = getState(interpreter); - const eventReactionCouplings = getMatchingEventReactionCouplings(state, nextEvent); + const eventReactionCouplings = getMatchingEventReactionCouplings(state, event); const reactions = eventReactionCouplings .map((eventReactionCoupling)=>eventReactionCoupling.reactions) .flat(); const {sideEffects, contextMutations, goto_} = categorizeReactions(reactions); - // can process sideEffects in parallel: + // can process sideEffects in parallel (though we currently don't due to the overhead of doing so in Node.js): sideEffects.forEach((sideEffect)=>{ - sideEffect.fn(interpreter.context, nextEvent, interpreter); + sideEffect.fn(interpreter.context, event, interpreter); }); // must process contextMutations in-series: contextMutations.forEach((contextMutation)=>{ - interpreter.context = contextMutation.fn(interpreter.context, nextEvent, interpreter); + interpreter.context = contextMutation.fn(interpreter.context, event, interpreter); }); // processing of `goto` must be last: if(goto_ !== null){