rename variable for clarity
This commit is contained in:
+6
-6
@@ -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){
|
||||
|
||||
Reference in New Issue
Block a user