This shows the execution order given JavaScript's Call Stack, Event Loop, and any asynchronous APIs provided in the JS execution environment (in this example; Web APIs in a Browser environment)
Given the code
| { | |
| "nodes": [ | |
| { | |
| "parameters": { | |
| "modelId": { | |
| "__rl": true, | |
| "value": "gpt-3.5-turbo-0125", | |
| "mode": "list", | |
| "cachedResultName": "GPT-3.5-TURBO-0125" | |
| }, |
| const express = require("express"); | |
| module.exports = (app, { base = "" } = {}) => ({ | |
| applyApi: api => app.use(base + api.base, buildRouter(api)), | |
| applyRoute: route => applyRoute(app, { base })(route), | |
| applyMiddleware: middleware => app.use(awaitHandlerFactory(middleware)) | |
| }); | |
| function buildRouter(api) { | |
| const routeReducer = (router, key) => applyRoute(router)(api.methods[key]); |
| import buildAsyncStages from "../stages/async-stages"; | |
| import { handleFetchError } from "../errors"; | |
| const ASYNC_FETCH = "ASYNC_FETCH"; | |
| const baseRequestOptions = { credentials: "same-origin" }; | |
| const fetchMiddleware = fetchImplementation => store => next => action => { | |
| next(action); |
| function buildStrictStorage() { | |
| const storage = {}; | |
| return new Proxy(storage, { | |
| get: (target, property) => { | |
| if (!Reflect.has(target, property)) { | |
| throw new Error(`Label "${property}" is missing.`); | |
| } | |
| return Reflect.get(target, property); |
| const path = require("path"); | |
| const packageJson = require("./package"); | |
| const buildConfig = packageJson.build; | |
| if (!buildConfig) { | |
| throw new Error("There is no configuration for build."); | |
| } | |
| const pipeline = buildConfig.pipeline; | |
| if (!pipeline) { |
| (function (module, bus, _, logger, Q) { | |
| module.createInstance = _createInstance; | |
| function _createInstance(context, instanceConfig, settings) { | |
| var initSequence = [ | |
| _initState.bind(this, instanceConfig, settings, context), | |
| _initViewModel, | |
| _initApp, |
| (function () { | |
| angular | |
| .module('projectName') | |
| .service('searchService', _searchService); | |
| function _searchService($log, $q, _, lunr, reportsService, userService) { | |
| var state; | |
| var reindexPromise = $q.when(""); |
| import React from "react"; | |
| const renderDefinition = definition => props => | |
| definition && definition.Component ? ( | |
| <definition.Component {...props} /> | |
| ) : null; | |
| const renderFirst = definitions => props => { | |
| const definition = definitions.find(definition => | |
| definition.condition(props) |
| One always has, at every stage, in the process, a working system. I | |
| find that teams can grow much more complex entities in four months | |
| than they can build. | |
| -- Fred Brooks, "No Silver Bullet" | |
| % | |
| I made this letter longer than usual because I lack the time to make it shorter. |