rename variable for clarity

main
Avraham Sakal 2 years ago
parent 8408926b99
commit 7c4b48c391

@ -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){

Loading…
Cancel
Save