!7 module YesPopupModule { transient YesPopup popup; transient S moduleID; // which module are we showing the popup for transient long popupSince; start { dm_onTopInput_q(voidfunc(S s) { if "yes" accept(); }); } void accept { if (popupShowing()) dm_call(moduleID, 'yes); } void cleanMeUp { hidePopup(); } void hidePopup { removeFromParent(popup); popup = null; moduleID = null; popupSince = 0; } // API void showYesPopup(S moduleID, Component component, O... _) { hidePopup(); popup = showYesToAcceptPopup(component, _); this.moduleID = moduleID; popupSince = now(); } void hideYesPopup(S moduleID) { if (eq(moduleID, this.moduleID)) hidePopup(); } bool popupShowing() { ret isShowing(popup); } }