D3.js queue.abort() Function Last Updated : 04 Aug, 2020 Summarize Comments Improve Suggest changes Share Like Article Like Report The queue.abort() function in d3.js is used to abort every function of deferred tasks. If any deferred task does not return any abort than it will continue to execute further. Syntax: queue.abort(); Parameters: This function does not accept any parameter. Returns: It returns the object. Below given are a few examples of the above function. Example 1: Certain function calls will be executed. HTML <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta name="viewport" path1tent="width=device-width, initial-scale=1.0"> <title>Document</title> </head> <style> </style> <body> <script src = "https://d3js.org/d3.v4.min.js"> </script> <script> function func1(){ console.log("from function func1") } function func2(){ console.log("from function func2") } function func3(){ console.log("from function func3") } function func4(){ setTimeout(func3, 500); } let q=d3.queue(3) q.defer(func1) q.defer(func4) q.abort() // This will not be executed. q.defer(func2) console.log(q) console.log("Size of q is: ",q._size) </script> </body> </html> Output: Example 2: No function will be executed. HTML <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta name="viewport" path1tent="width=device-width, initial-scale=1.0"> <title>Document</title> </head> <style> </style> <body> <script src = "https://d3js.org/d3.v4.min.js"> </script> <script> function func1(){ console.log("from function func1") } function func2(){ console.log("from function func2") } function func3(){ console.log("from function func3") } function func4(){ setTimeout(func3, 500); } let q=d3.queue(3) // Using abort function to force // every deferred function to return abort. q.abort() // These functions will not be executed. q.defer(func1) q.defer(func4) q.defer(func2) console.log("No function will be executed.") console.log("Size of q is: ",q._size) </script> </body> </html> Output: Comment More infoAdvertise with us Next Article D3.js timer.stop() Function T tarun007 Follow Improve Article Tags : JavaScript Web Technologies D3.js Similar Reads D3.js queue() Function The d3.queue() function is used to create a queue of a specified size. If the size is not given by default it is taken as infinite. Syntax: d3.queue(size); Parameters: This function accepts a single parameter mentioned above and described below: size: It is the optional parameter if it is not given 2 min read D3.js queue.defer() Function The queue.defer() function in d3.js is used to add the asynchronous task callback to the queue. Where the task is a function to be executed. The callback must be executed when the task got finished. Syntax: queue.defer(task[, argumentsâ¦]); Parameters: This function accepts a single parameter as ment 2 min read D3.js timeout() Function The d3.timeout() function in D3.js is used to automatically stop the function or the timer after a particular interval of time. It works same as setTimeOut() function in JavaScript. Syntax: d3.timeout(callback, delay); Parameters: This function accepts two parameters as mentioned above and described 2 min read D3.js timer.stop() Function The timer.stop() function in D3.js is used to stop the current ongoing timer function thus preventing further calls to the function. This function will only work if the timer has not stopped yet. Syntax: timer.stop() Parameters: It takes no parameters. Returns: It does not return anything. Note: The 2 min read D3.js timer.restart() Function The timer.restart() function in D3.js is used to restart a timer with the given function and delay. The timer.restart() function is used when one wants to reset the timer and start again. Syntax: timer.restart(callback, delay); Parameters: It takes two parameters as mentioned above and described bel 2 min read Underscore.js _.debounce() Function Underscore.js _.debounce() Function in Underscore.js is used to create a debounced function that is used to delay the execution of the given function until after the given wait time in milliseconds has passed since the last time this function was called. The debounced function has a cancel method th 2 min read Like