Libraryless. Click here for Pure Java version (10346L/72K).
1 | sclass FunctionsLoader implements AutoCloseable { |
2 | Set<S> functions; |
3 | O blob; |
4 | Throwable exception; |
5 | bool loading; |
6 | L<Runnable> onLoaded = syncList(); // also called on fail |
7 | O[] loadFunctionsParams; |
8 | |
9 | *(Iterable<S> functions) { this.functions = asSet(functions); } |
10 | |
11 | synchronized void loadInBackground { |
12 | if (!loading) { |
13 | loading = true; |
14 | startThread(r load); |
15 | } |
16 | } |
17 | |
18 | void load { |
19 | try { |
20 | blob = loadFunctions(functions, loadFunctionsParams); |
21 | } catch print e { |
22 | exception = e; |
23 | } |
24 | pcallFAll(onLoaded); |
25 | } |
26 | |
27 | public void close { |
28 | dispose blob; |
29 | } |
30 | |
31 | bool loaded() { ret blob != null || exception != null; } |
32 | bool hasCode() { ret blob != null; } |
33 | |
34 | O blob() { ret blob; } |
35 | |
36 | void onLoaded(Runnable r) { onLoaded.add(r); } |
37 | } |
download show line numbers debug dex old transpilations
Travelled to 7 computer(s): bhatertpkbcr, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tvejysmllsmz, vouqrxazstgt, xrpafgyirdlv
No comments. add comment
Snippet ID: | #1026811 |
Snippet name: | FunctionsLoader |
Eternal ID of this version: | #1026811/9 |
Text MD5: | 7f38720ef5e145948fcfa34db38da080 |
Transpilation MD5: | dbce0999e4a114dc6d039de8604f4752 |
Author: | stefan |
Category: | javax |
Type: | JavaX fragment (include) |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2020-01-23 23:02:01 |
Source code size: | 824 bytes / 37 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 255 / 643 |
Version history: | 8 change(s) |
Referenced in: | [show references] |