Skip to content

pantoken / formats/interactions/src / initModal

ฟังก์ชัน: initModal()

initModal(host, dialog, onCommand): void

เชื่อมต่อ CSS <dialog class="instui-modal"> หรือ shadow ของเว็บคอมโพเนนต์ <dialog> เข้ากับโปรโตคอลแอตทริบิวต์ open และ --show/--close/--toggle การจัดเส้นทางคำสั่ง ทั้งสองการใช้งานส่งอินเทอร์เฟซเดียวกัน:

  • CSS: host === dialog (the dialog itself carries the id and open attr)
  • WC: host = custom element, dialog = its shadow &lt;dialog&gt;

พารามิเตอร์

host

HTMLElement

dialog

HTMLDialogElement

onCommand

OnCommand

คืนค่า

void