Not logged in.  Login/Logout/Register | List snippets | | Create snippet | Upload image | Upload data

57
LINES

< > BotCompany Repo | #1020257 // Yes Popup Module ["say yes to accept"]

JavaX source code (Dynamic Module) [tags: use-pretranspiled] - run with: Stefan's OS

Libraryless. Click here for Pure Java version (8981L/64K).

!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;
  }
}

download  show line numbers  debug dex  old transpilations   

Travelled to 9 computer(s): bhatertpkbcr, cfunsshuasjs, gwrvuhgaqvyk, hpgrupgrauku, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tvejysmllsmz, vouqrxazstgt

No comments. add comment

Snippet ID: #1020257
Snippet name: Yes Popup Module ["say yes to accept"]
Eternal ID of this version: #1020257/24
Text MD5: 28675261dfcd274d9fd497ad14775976
Transpilation MD5: 0301fb5f4b7e369fd02945eaf0fb4f34
Author: stefan
Category: javax / stefan's os
Type: JavaX source code (Dynamic Module)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2019-01-22 17:04:03
Source code size: 1067 bytes / 57 lines
Pitched / IR pitched: No / No
Views / Downloads: 281 / 1185
Version history: 23 change(s)
Referenced in: [show references]