Debian Codegraph @

addons/point_of_sale/static/src/customer_display/utils.js

raw
1 import { useService } from "@web/core/utils/hooks";
2
3 export function useSingleDialog() {
4 let close = null;
5 const dialog = useService("dialog");
6 return {
7 open(dialogClass, props) {
8 // If the dialog is already open, we don't want to open a new one
9 if (!close) {
10 close = dialog.add(dialogClass, props, {
11 onClose: () => {
12 close = null;
13 },
14 });
15 }
16 },
17 close() {
18 close?.();
19 },
20 };
21 }