Libraryless. Click here for Pure Java version (8981L/64K).
1 | !7 |
2 | |
3 | module YesPopupModule { |
4 | transient YesPopup popup; |
5 | transient S moduleID; // which module are we showing the popup for |
6 | transient long popupSince; |
7 | |
8 | start { |
9 | dm_onTopInput_q(voidfunc(S s) { |
10 | if "yes" |
11 | accept(); |
12 | }); |
13 | } |
14 | |
15 | void accept { |
16 | if (popupShowing()) { |
17 | fS mod = moduleID; |
18 | hidePopup(); |
19 | thread { |
20 | dm_callOpt(mod, 'yes); |
21 | } |
22 | } |
23 | } |
24 | |
25 | void cleanMeUp { |
26 | hidePopup(); |
27 | } |
28 | |
29 | void hidePopup { |
30 | removeFromParent(popup); |
31 | popup = null; |
32 | moduleID = null; |
33 | popupSince = 0; |
34 | } |
35 | |
36 | // API |
37 | |
38 | void showYesPopup(S moduleID, Component component, O... _) { |
39 | hidePopup(); |
40 | popup = showYesToAcceptPopup(component, _); |
41 | if (popup == null) ret; |
42 | this.moduleID = moduleID; |
43 | popupSince = now(); |
44 | } |
45 | |
46 | void hideYesPopup(S moduleID) { |
47 | if (eq(moduleID, this.moduleID)) hidePopup(); |
48 | } |
49 | |
50 | bool popupShowing() { |
51 | ret isShowing(popup); |
52 | } |
53 | |
54 | S moduleShowingPopup() { |
55 | ret !popupShowing() ? null : moduleID; |
56 | } |
57 | } |
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: | 402 / 1348 |
Version history: | 23 change(s) |
Referenced in: | [show references] |