# j-Loading

> j-Loading: it automatically assigns flags @showloading and @hideloading; NEW: style {Number} a loading style (default: 1)

Framework: jcomponent20
Product: jComponent 20 (jcomponent@20)
Language: en
Content-SHA256: fca954096b9603e12fa149fac058616bcf1f34e66131ff098dd1a559471551c5
Snapshot: c0700e321579725c5cf4f5ace1ad7d2866d1b4f93c24a63c0b41b6b7998e976c
Sources: components@910ed1a86f6e72b4f031d3ad0dc7844f9fc5cb8e
Review: not-recorded

- it automatically assigns flags `@showloading` and `@hideloading`

__Configuration__:

- __NEW__: `style {Number}` a loading style (default: `1`)
	- `1`: basic with animated spin
	- `2`: a blue line at the top of window

__Usage__:

- `SETTER('loading/show', [text])` - shows loading (`text` optional)
- `SETTER('loading/hide', [sleep])` - hides loading (`sleep` optional and in milliseconds)

Use it with `<ui-component name="loading">`. When the component is not loaded yet, jComponent downloads it on first use from the address in `DEF.fallback` (the Componentator CDN by default). Author: Peter Širka. Source: the Componentator components repository, MIT license.

```html example.html
<style>
	body { background-color: #F0F0F0; }
</style>

<ui-component name="loading" class="hidden"></ui-component>

<div>Lorem ipsum</div>
<div>Lorem ipsum</div>
<div>Lorem ipsum</div>
<div>Lorem ipsum</div>
<div>Lorem ipsum</div>
<div>Lorem ipsum</div>
<div>Lorem ipsum</div>

<script>
	var is = false;
	setInterval(function() {
		is = !is;
		if (is)
			SETTER('loading/show');
		else
			SETTER('loading/hide', 1000);
	}, 3000);
</script>
```
