Libraryless. Click here for Pure Java version (6461L/45K/143K).
!752 static Action lastAction; concepts. concept History { new RefL events; } abstract concept Input { } Input > TextInput { S line; *() {} *(S *line) { change(); } } abstract concept Action { Bool good; // true, false or null } Action > NoAction {} Action > PrintAction { S text; *() {} *(S *text) { change(); } } static History historyObj() { ret uniq(History); } static L<Concept> history() { ret historyObj().events; } static void historyAdd(Concept event) { historyObj().events.add(event); } p-awt { concepts(); showControls(jcenteredLine( jbutton("Good!", "good"), jbutton("Bad!", "bad"))); makeBot(); } synchronized answer { historyAdd(new TextInput(s)); if "hello" { S answer = "Hello!"; historyAdd(new PrintAction(answer)); ret answer; } } static Action lastAction() { Concept last = last(history()); if (!last << Action) { historyAdd(last = new NoAction); print("I'm assuming you mean my lack of action?"); } ret last/Action; } svoid good { Action action = lastAction(); if (action == null) ret; if (isTrue(action.good)) print("Thanks, I know! :-)"); else { cset(action, good := true); print("Thanks, saved!"); } } svoid bad { Action action = lastAction(); if (action == null) ret; if (isFalse(action.good)) print("I heard that before..."); else { cset(action, good := false); print("I don't know what I did wrong yet, but I'll save this feedback!"); } }
download show line numbers debug dex old transpilations
Travelled to 14 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, sawdedvomwva, tslmcundralx, tvejysmllsmz, vouqrxazstgt
No comments. add comment
Snippet ID: | #1005922 |
Snippet name: | User Feedback [dev.] |
Eternal ID of this version: | #1005922/1 |
Text MD5: | f4856e8869a0cfeec21c391df58d1805 |
Transpilation MD5: | fddc347947c34d29f0fa83ff91d9e62a |
Author: | stefan |
Category: | javax / gui |
Type: | JavaX source code |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2016-12-12 20:01:13 |
Source code size: | 1585 bytes / 87 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 551 / 649 |
Referenced in: | -