!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()) { fS mod = moduleID; hidePopup(); thread { dm_callOpt(mod, '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, _); if (popup == null) ret; this.moduleID = moduleID; popupSince = now(); } void hideYesPopup(S moduleID) { if (eq(moduleID, this.moduleID)) hidePopup(); } bool popupShowing() { ret isShowing(popup); } S moduleShowingPopup() { ret !popupShowing() ? null : moduleID; } }