{"version":3,"file":"callback_queue-CiAqZnaS.js","sources":["../../../app/assets/javascripts/app/authentication/callback_queue.ts"],"sourcesContent":["\ntype CallbackFunc = (() => void)\n\nlet _callback_functions_with_slot = {} as {\n [index: string]: CallbackFunc\n}\nlet _callback_functions_without_slot = [] as CallbackFunc[]\n\n\nconst add = (callback: (() => void), slot_name: string) => {\n if (slot_name){\n _callback_functions_with_slot[slot_name] = callback\n }\n else{\n _callback_functions_without_slot.push(callback)\n }\n}\n\n// Cannot remove callback without slot_name\nconst remove = (slot_name: string) => {\n delete _callback_functions_with_slot[slot_name]\n}\n\nconst drain = () => {\n Object.values(_callback_functions_with_slot).forEach((func) => {\n // async call\n setTimeout(func, 0)\n })\n _callback_functions_without_slot.forEach((func) => {\n setTimeout(func, 0)\n })\n}\n\nconst clear = () => {\n _callback_functions_with_slot = {}\n _callback_functions_without_slot = []\n}\n\nexport default {\n _callback_functions_with_slot,\n _callback_functions_without_slot,\n add,\n remove,\n drain,\n clear,\n}\n\n"],"names":["_callback_functions_with_slot","_callback_functions_without_slot","add","callback","slot_name","remove","drain","func","clear","Auth_callback_queue"],"mappings":"AAGA,IAAIA,EAAgC,CAAC,EAGjCC,EAAmC,CAAC,EAGxC,MAAMC,EAAM,CAACC,EAAwBC,IAAsB,CACrDA,EACFJ,EAA8BI,CAAS,EAAID,EAG3CF,EAAiC,KAAKE,CAAQ,CAElD,EAGME,EAAUD,GAAsB,CACpC,OAAOJ,EAA8BI,CAAS,CAChD,EAEME,EAAQ,IAAM,CAClB,OAAO,OAAON,CAA6B,EAAE,QAASO,GAAS,CAE7D,WAAWA,EAAM,CAAC,CAAA,CACnB,EACgCN,EAAA,QAASM,GAAS,CACjD,WAAWA,EAAM,CAAC,CAAA,CACnB,CACH,EAEMC,EAAQ,IAAM,CAClBR,EAAgC,CAAC,EACjCC,EAAmC,CAAC,CACtC,EAEeQ,EAAA,CACb,8BAAAT,EACA,iCAAAC,EACA,IAAAC,EACA,OAAAG,EACA,MAAAC,EACA,MAAAE,CACF"}