Callback
A callback is a function or other callable supplied to software for invocation later in response to a specified event, condition, or point in execution.
Secrets of the JavaScript Ninja, Second Edition
A function supplied to other code to be invoked later when a condition or event occurs.
- How it is used
- Uses callbacks to customize array operations, respond to browser events, and handle results of nonblocking tasks.
- How deep it goes
- Defines callbacks through invocation flow and works through closures, function context, and asynchronous error-handling pitfalls.
- Examples
- Shows a passed function being invoked, an animation timer retaining state, and nested JSON requests with error arguments.
- What you can do after
- Build it from scratch as a function parameter, then apply it to events, collection operations, and asynchronous results.
Read how Secrets of the JavaScript Ninja, Second Edition explains callback →
Data Pipelines with Apache Airflow, Second Edition
A callback is a function supplied to another component so that it is invoked when a specified event occurs.
- How it is used
- Triggers incident notifications when DAG runs or tasks fail, and supports task success and retry responses.
- How deep it goes
- Shows where to configure callbacks and propagate task settings, but leaves the notification function’s implementation to the reader.
- Examples
- Uses a printing failure function assigned to a DAG and all its tasks, alongside a BashOperator that exits with an error.
- What you can do after
- Operate/configure it by assigning Python functions to DAG or task event arguments and choosing whether built-in failure email suffices.
Read how Data Pipelines with Apache Airflow, Second Edition explains callback →
The Well-Grounded Rubyist, Fourth Edition
A callback is a method or function that a runtime invokes automatically in response to a specified event or lifecycle operation.
- How it is used
- Uses event-triggered methods to react to module operations, subclassing, method definitions, and unresolved names at runtime.
- How deep it goes
- Works through callback arguments, triggering behavior, singleton-class contrasts, and a small test runner rather than presenting an exhaustive API reference.
- Examples
- Demonstrates inclusion adding a class method, extension reporting its receiver, and test methods executing when defined.
- What you can do after
- Build it from scratch: combine `inherited` and `method_added` to run setup and test methods as they are defined.
Read how The Well-Grounded Rubyist, Fourth Edition explains callback →
Functional Programming in Scala, Second Edition
A callback is a function supplied to an asynchronous operation so that the operation can report completion or a result later.
- How it is used
- Adapts non-blocking operations into Par so asynchronous results can be composed without blocking.
- How deep it goes
- Defines callback-based Future encoding and traces adapters through Par, Free, completion handlers, and Actor-based map2.
- Examples
- Uses byte-source reads, AsynchronousFileChannel completion handlers, and parallel map2 result coordination.
- What you can do after
- Apply it via Par.async to wrap a callback-based I/O request as a composable Par action.
Read how Functional Programming in Scala, Second Edition explains callback →
Functional Programming in JavaScript
A programming pattern in which a function is passed to another operation to be invoked later, often for asynchronous control flow.
- How it is used
- Coordinates nonblocking requests and event responses without freezing the user interface.
- How deep it goes
- Explains timing, inversion of control, errors, nested callbacks, and loop closures, but stops short of a scalable asynchronous abstraction.
- Examples
- Uses XMLHttpRequest, student records, grades, button clicks, mouseover events, nested JSON calls, and a loop closure bug.
- What you can do after
- Apply it via JavaScript callbacks to sequence asynchronous work, process returned data, and handle request errors.
Read how Functional Programming in JavaScript explains callback →
BDD in Action, Second Edition
A hook is a framework callback method that runs before or after a specified software execution event.
- How it is used
- Uses hooks to prepare and clean up acceptance-test environments without putting technical housekeeping in business-readable scenarios.
- How deep it goes
- Defines lifecycle callbacks and demonstrates scenario-level, tag-specific, and test-run hooks, while noting that implementation details vary by tool.
- Examples
- Shows database reference-data setup, result logging, tagged ChromeDriver setup and cleanup, and test-run database-container management.
- What you can do after
- Apply it via Cucumber hooks to isolate scenarios and manage browser or database resources at the appropriate lifecycle point.
Build an AI Agent (From Scratch)
A callback is a callable supplied to software so it can be invoked automatically at a specified event or stage of execution.
- How it is used
- Extends an agent’s execution at defined points without modifying its core logic.
- How deep it goes
- Implements tool-callback registration, return contracts, early exit, and awaitable results; defers asynchronous human approval and after-run memory.
- Examples
- Uses a file-deletion approval prompt and a web-search result compressor registered on one agent.
- What you can do after
- Build it from scratch by adding tool-callback hooks, then use them to gate tool calls or replace results.
Read how Build an AI Agent (From Scratch) explains callback →
Refactoring to Rust
A callback function is a function supplied to another operation so that it can be invoked when a specified event or computation completes.
- How it is used
- Uses callbacks to continue NGINX request processing after the HTTP request body becomes available.
- How deep it goes
- Explains callback registration, C-compatible signatures, raw pointers, null checks, and body parsing, but not general callback abstractions.
- Examples
- Demonstrates read_body_handler passed to NGINX and used to inspect a request body.
- What you can do after
- Build callbacks for NGINX FFI integrations and validate raw request pointers before processing data.
React in Depth
A callback function is a function supplied to another function or API to be invoked as part of that operation.
- How it is used
- Connects component events, custom-hook behavior, state transitions, and child-component APIs.
- How deep it goes
- Explains invocation, prop passing, custom-hook exports, TypeScript signatures, memoization, and callback testing.
- Examples
- Uses task managers, todo deletion, and reorderable playlists to demonstrate callback composition, testing, typing, and memoization.
- What you can do after
- Build it from scratch by passing, typing, memoizing, composing, and testing callbacks in React components and hooks.
Build Python Web Apps with Streamlit
A callback is a function supplied to another component for execution in response to a later event.
- How it is used
- Handles button-driven state transitions before Streamlit reruns the page.
- How deep it goes
- Explains execution order, automatic reruns, and one restriction while stopping short of broader callback patterns.
- Examples
- Uses a Next question button to call game.proceed_to_next_question in a trivia game.
- What you can do after
- Apply it via Streamlit's st.button to update game state before the resulting rerun.
Read how Build Python Web Apps with Streamlit explains callback →
The Joy of JavaScript
A callback is a function passed as an argument to another function to be invoked later or in response to an event or condition.
- How it is used
- Coordinates asynchronous operations and composes behavioral sequences through functions passed for later execution.
- How deep it goes
- Defines callbacks, relates them to the event loop, and contrasts them with Promises; it stops short of detailed runtime internals.
- Examples
- Uses mouse events, HTTP requests, error-first file reads, and chained asynchronous operations as examples.
- What you can do after
- Apply callbacks to represent asynchronous follow-up work and compose behavioral sequences in JavaScript.
Deep Learning with R, Third Edition
A Keras callback is an object invoked at specified points during model training or evaluation to monitor state or perform actions.
- How it is used
- Customizes fit() by monitoring training state and scheduling actions at batch, epoch, or run boundaries.
- How deep it goes
- Explains built-in uses, callback configuration, lifecycle methods, logs, and custom implementations without detailing framework internals.
- Examples
- Demonstrates MNIST checkpointing and early stopping, per-batch loss plotting, and generated-image grids displayed after epochs.
- What you can do after
- Apply it via Keras to monitor training, stop overfitting runs, preserve best models, adjust parameters, or create custom visualizations.
Read how Deep Learning with R, Third Edition explains callback →
Logs and Telemetry
A callback is a function invoked by a framework or runtime in response to a lifecycle event or processing opportunity.
- How it is used
- Coordinates input-plugin lifecycle events and transforms retrieved database records into Fluent Bit payloads.
- How deep it goes
- Shows registration, initialization, processing, cleanup, and exit implementations, including configuration, encoding, state, and return codes.
- Examples
- Uses Go functions for registration, initialization, input processing, cleanup, and exit, with database records as input.
- What you can do after
- Build it from scratch by implementing lifecycle callbacks for a Go-based Fluent Bit input plugin.
Fast Python: High performance techniques for large datasets
- How it is used
- Reports map-and-reduce progress by receiving task-completion counts during asynchronous execution.
- How deep it goes
- Specifies callback timing and arguments, then contrasts granular polling with an API that calls back only at completion.
- Examples
- Demonstrates a word-count reporter that prints completed and total tasks for map and reduce phases.
- What you can do after
- Operate progress reporting by supplying a fast reporter with the required tag, completed, and unfinished arguments.
Read how Fast Python: High performance techniques for large datasets explains callback →
Machine Learning for Tabular Data: XGBoost, Deep Learning, and AI
A Keras callback is an object that runs user-defined actions at specified points during model training or evaluation.
- How it is used
- Controls training efficiency and preserves peak validation performance during Keras model fitting.
- How deep it goes
- Defines callbacks and demonstrates fit() integration, conditional configuration, and early-stopping controls without detailing callback internals.
- Examples
- Uses Keras model.fit(), configuration-driven early stopping, and LightGBM logging and early-stopping callbacks.
- What you can do after
- Operate/configure training with callbacks that stop stalled runs and select the strongest observed model state.
Read how Machine Learning for Tabular Data: XGBoost, Deep Learning, and AI explains callback →
D3.js in Action, Third Edition
A callback function is a function supplied to another operation so that it can be invoked when a specified event or processing step occurs.
- How it is used
- Uses callbacks to prepare D3 data and trigger visualization updates when users interact with controls.
- How deep it goes
- Explains row-wise conversion, returned fields, event parameters, and conditional updates without descending into callback execution internals.
- Examples
- Demonstrates numeric CSV conversion, console logging, filter-button clicks, active-state checks, and histogram updates.
- What you can do after
- Apply it via D3 to convert imported records and handle events using event and datum parameters.
Deep Learning with Python, Third Edition
A user-defined callback that runs automatically during training to perform extra actions such as monitoring outputs.
- How it is used
- Customizes Keras training by observing progress and performing monitoring, visualization, saving, stopping, or parameter updates.
- How deep it goes
- Explains callback objects, lifecycle hooks, logs, subclassing, and working implementations, but does not detail callback internals beyond these APIs.
- Examples
- Uses batch-loss plotting, MNIST training, checkpoint restoration, and epoch-end grids of generated images.
- What you can do after
- Build it from scratch by subclassing keras.callbacks.Callback, implementing hooks, reading logs, and registering the instance with model.fit().
Read how Deep Learning with Python, Third Edition explains callback →
Essential TypeScript 5, Third Edition
A callback is a function supplied to another function or method so that it can be invoked later in response to an operation or event.
- How it is used
- Connects UI components by passing event-driven actions and selected data through props.
- How deep it goes
- Explains callback signatures, JSX invocation, and this-binding pitfalls, but does not develop callback implementation beyond application examples.
- Examples
- Uses product filtering, quantity selection, order submission, header buttons, and order-details components.
- What you can do after
- Apply it via TypeScript and JSX by typing callbacks, passing them through props, and invoking them from event handlers.
Read how Essential TypeScript 5, Third Edition explains callback →
Related concepts
- call_onceused by · call_once is a threading operation that coordinates callers so a specified callback is successfully executed at most once for a given once-control object.
- replace body with callbackused by · A refactoring technique that extracts unchanged before-and-after code into a function and supplies the varying body as a callback argument.
- forEachused by · The JavaScript Array forEach method invokes a callback once for each assigned element of an array, in ascending index order.
- functionkind of · A function is a defined operation that maps inputs to outputs and, when implemented as a callable program unit, may also produce effects.
- event loopused by · An event loop is a runtime mechanism that repeatedly selects ready events or tasks and dispatches their associated work for execution.
These guides are generated from the text of Manning books by Manning's knowledge graph and link to the sections they draw on. The full books are available on liveBook and at manning.com.

















