Function - Callback function

Model Funny

About

A callback function is called back by the higher-order function that takes it as parameter.

Callbacks is a method of enabling asynchrony (asynchronous operation).

A callback is a function that is passed as an argument to another function and is executed after its parent function has completed.

As a callback is a function/interface that tend to have only one method, they are generally functional interface.

A callback function is generally used as event handler to respond to an event.

Example

Basic example in Javascript.

callback = function () {
   console.log("Hello Callback");
}

function highOrder(callbackFunctionToCall){
  // Call the callback function
  callbackFunctionToCall();
}

highOrder(callback);

Hell

The callback hell is when there is so much callback that it build a multiple levels of nested callbacks rendering the code difficult to understand.





Discover More
Card Puncher Data Processing
Antlr - Parse Tree Listener

The parse tree listener (or listener) is a class that implements callback methods that are called by the parser when it creates the parse tree. You can overwrite this class to get information when the...
Data System Architecture
Conccurency - Asynchronous Model

Asynchronous allows an application to issue multiple requests and continue executing while the server performs the request. This type of request can improve an application’s throughput because it allows...
Data System Architecture
Concurrency - Model (Design)

list of asynchronous (concurrent/parallel) design producer-consumer, messaging, promise / future
Devtool Chrome Event Listener
DOM - Event Callback Function (Attach function to Event)

An event callback is a callback function that is executed when a event is fired. The Event callback function can be added / defined through: the setting of an event handler on.... such as onclick ...
Card Puncher Data Processing
Design Pattern - Observer (Publish-subscribe model|Pub Sub)

An observer makes a observation by creating an event and passing it to a callback method of the subscriber. The observer is also called a message broker because it dispatches the event (ie message) to...
Model Funny
Function - First Class Function (Closure|Function Literal)

A programming language is said to support first-class functions if it treats functions as first-class objects. The language supports: constructing new functions during the execution of a program,...
Model Funny
Function - High Order Function

Higher-order functions are the basis of functional programming. Higher-order functions are functions that: take other functions as arguments or return functions as their result. See also: Duplicate...
HTTP - Webhook (Callback)

A Webhook is a script that makes an HTTP callback when a specific action occurs (a event-notification). Webhooks push information to endpoint when an action occurs via an request. For instance: a POST...
Javascript - Callback

This page is callbacks in Javascript. It is the primary method of enabling asynchrony. With argument, you are not passing the function but the return value of the function. You need then to wrap...
Php Error Level Enotice Not Set
Php - Standard Error Handling

This page is the standard error handling system of php known also as the error functions. This system: triggers error at a certain level that may be caught via a global callback function. ...



Share this page:
Follow us:
Task Runner