import{Queue}from'@adrien.pgd/nodejsutilities'constmy_queue=newQueue();my_queue.on("enqueue",new_item=>{console.log(`New element added at the end of the queue. Element(${new_item})`)})my_queue.on("dequeue",deleted_item=>{console.log(`First element of the queue have been removed. Element(${deleted_item})`)})my_queue.enqueue(5);// my_queue = {5}constvalue=my_queue.peek();// value = 5constvalue2=my_queue.dequeue();// value2 = 5; my_queue = {}
Tasks
Implementation of a Tasks system based on a queue.
The purpose of this class is to provide a queue that will receive functions and executed them by order.
Example of use : If you need to chain advertising messages.