Libraryless. Click here for Pure Java version (6254L/35K).
static <A> SimpleLiveValue<A> varWithNotifyToLiveValue(Class<A> type, IVarWithNotify<A> var) { if (var == null) null; var lv = new SimpleLiveValue<A>(type); var lvRef = weakRef(lv); var.onChange(r { var lv = lvRef!; print ifdef varWithNotifyToLiveValue_debug("varWithNotifyToLiveValue var.onChange " + lv); if (lv == null) var.removeChangeListener(this); else { var value = var!; print ifdef varWithNotifyToLiveValue_debug("varWithNotifyToLiveValue value " + value); lv.set(value); } }); lv.onChange(-> var.set(lv!)); lv.set(var!); ret lv; }
download show line numbers debug dex old transpilations
Travelled to 4 computer(s): bhatertpkbcr, ekrmjmnbrukm, mowyntqkapby, mqqgnosmbjvj
No comments. add comment
Snippet ID: | #1034093 |
Snippet name: | varWithNotifyToLiveValue |
Eternal ID of this version: | #1034093/7 |
Text MD5: | 35f776f1de61712be618e99eaa999fae |
Transpilation MD5: | f4b6712798262972900514484e254b8f |
Author: | stefan |
Category: | javax / gui |
Type: | JavaX fragment (include) |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2022-02-08 02:31:09 |
Source code size: | 619 bytes / 19 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 165 / 270 |
Version history: | 6 change(s) |
Referenced in: | #1006654 - Standard functions list 2 (LIVE, continuation of #761) #1034515 - varWithNotifyToLiveValue_verbose |