MCPcopy Create free account
hub / github.com/facebook/Rapid / uiLoading

Function uiLoading

modules/ui/loading.js:6–63  ·  view source on GitHub ↗
(context)

Source from the content-addressed store, hash-verified

4
5
6export function uiLoading(context) {
7 const assets = context.systems.assets;
8
9 let _modalSelection = d3_select(null);
10 let _message = '';
11 let _blocking = false;
12
13
14 let loading = (selection) => {
15 _modalSelection = uiModal(selection, _blocking);
16
17 let loadertext = _modalSelection.select('.content')
18 .classed('loading-modal', true)
19 .append('div')
20 .attr('class', 'modal-section fillL');
21
22 loadertext
23 .append('img')
24 .attr('class', 'loader')
25 .attr('src', assets.getFileURL('img/loader-white.gif'));
26
27 loadertext
28 .append('h3')
29 .text(_message);
30
31 _modalSelection.select('button.close')
32 .attr('class', 'hide');
33
34 return loading;
35 };
36
37
38 loading.message = function(val) {
39 if (!arguments.length) return _message;
40 _message = val;
41 return loading;
42 };
43
44
45 loading.blocking = function(val) {
46 if (!arguments.length) return _blocking;
47 _blocking = val;
48 return loading;
49 };
50
51
52 loading.close = () => {
53 _modalSelection.remove();
54 };
55
56
57 loading.isShown = () => {
58 return _modalSelection && !_modalSelection.empty() && _modalSelection.node().parentNode;
59 };
60
61
62 return loading;
63}

Callers 4

fromJSONAsyncMethod · 0.90
initAsyncMethod · 0.90
constructorMethod · 0.90
_showLoadingMethod · 0.90

Calls 1

removeMethod · 0.45

Tested by

no test coverage detected