no versions found for ApplicationFrameworkReferences / Utility/Popup/popup_registerCustomFrame / en

Popup: registerCustomFrame()

カスタムのポップアップのフレームを Popup に登録します。

構文

Popup.registerCustomFrame(id, frameClass) => PopupFrame | undefined

引数

  • id: string

    カスタムフレームを登録する識別子です。この識別子は openCustom() で登録したフレームを呼び出す時に利用します。

  • frameClass: new () => PopupFrame

    登録するカスタムフレームです。PopupFrame を継承したクラスオブジェクトです。

返値: new () => PopupFrame | undefined

登録した id が既に使用されていれば更新前のフレームのクラスオブジェクト、登録されていなければ undefined となります。

例外

  • TypeError
    • 引数 id が文字列ではない場合。
    • 引数 frameClassPopupFrame の派生クラスではない場合。

const html = `
<div id="test-overlay" data-ui-component data-active-events="click">
    <alier-view id="test-popup" data-ui-component data-active-events="click"></alier-view>
</div>
`;
class TestPopup extends ModalFrame {
    constructor() {
        super();
         this.loadContainer({ text: html, id: "test-overlay" });
        this.relateElements(this.collectElements(this.container));
    }
}
Popup.registerCustomFrame("test", TestPopup);
await Popup.openCustom("test", new MyPopup());

解説

任意の識別子 id でカスタムした PopupFramePopup に登録します。

登録したカスタムポップアップは openCustom() で表示することができます。

登録済みのフレームと id が重複した場合、フレームを上書きして元のフレームが返値として返されます。