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); });
|
Object.values(interpreter.subscriptions).forEach((subscriptionCallbackFunction)=>{ subscriptionCallbackFunction(interpreter); });
|
||||||
}
|
}
|
||||||
function processNextEvent(interpreter:Interpreter_T){
|
function processNextEvent(interpreter:Interpreter_T){
|
||||||
const nextEvent = interpreter.eventQueue.shift();
|
const event = interpreter.eventQueue.shift();
|
||||||
if(typeof nextEvent !== 'undefined'){
|
if(typeof event !== 'undefined'){
|
||||||
const state = getState(interpreter);
|
const state = getState(interpreter);
|
||||||
const eventReactionCouplings = getMatchingEventReactionCouplings(state, nextEvent);
|
const eventReactionCouplings = getMatchingEventReactionCouplings(state, event);
|
||||||
const reactions = eventReactionCouplings
|
const reactions = eventReactionCouplings
|
||||||
.map((eventReactionCoupling)=>eventReactionCoupling.reactions)
|
.map((eventReactionCoupling)=>eventReactionCoupling.reactions)
|
||||||
.flat();
|
.flat();
|
||||||
const {sideEffects, contextMutations, goto_} = categorizeReactions(reactions);
|
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)=>{
|
sideEffects.forEach((sideEffect)=>{
|
||||||
sideEffect.fn(interpreter.context, nextEvent, interpreter);
|
sideEffect.fn(interpreter.context, event, interpreter);
|
||||||
});
|
});
|
||||||
// must process contextMutations in-series:
|
// must process contextMutations in-series:
|
||||||
contextMutations.forEach((contextMutation)=>{
|
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:
|
// processing of `goto` must be last:
|
||||||
if(goto_ !== null){
|
if(goto_ !== null){
|
||||||
|
|||||||
Reference in New Issue
Block a user