# j-NotifyBar

> j-NotifyBar: Singleton; Erfolgsmeldung SETTER('notifybar/success', 'MESSAGE')

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

- Singleton
- Erfolgsmeldung `SETTER('notifybar/success', 'MESSAGE')`
- Warnmeldung `SETTER('notifybar/warning', 'MESSAGE')`
- Infonachricht `SETTER('notifybar/info', 'MESSAGE', '[BUTTON_LABEL]', [callback_dismiss])`


__Konfiguration__:

- `timeout` {Number} Ein Timout in Millisekunden (Default: `4000`)

__Methoden__:

- `component.success(message)` bringt Erfolgsgeschichte
- `component.warning(message)` stellt eine Warnmeldung auf
- `component.info(message)` informiert die Nachricht
- `component.hide()` versteckt die Bar
- `component.show()` zeigt die letzte Nachricht

__Funktioniert mit ASETTER__:

- Fehler werden automatisch behandelt

```javascript
// Without callback
AJAX('POST /api/profile/', userprofile, ASETTER('notifybar/response', 'Profile has been saved successfully'));

// Or with a callback
AJAX('POST /api/profile/', userprofile, ASETTER('notifybar/response', 'Profile has been saved successfully', function(response) {
	console.log(response);
}));

// Or with a callback and without message
AJAX('POST /api/profile/', userprofile, ASETTER('notifybar/response', function(response) {
	console.log(response);
}));

// With auto-binding
AJAX('POST /api/profile/', userprofile, ASETTER('notifybar/response', '?.response'));
AJAX('POST /api/profile/', userprofile, ASETTER('notifybar/response', 'Your message', '?.response'));
```

Verwenden Sie es mit `<ui-component name="notifybar">`. Wenn die Komponente noch nicht geladen ist, lädt jComponent sie bei der ersten Verwendung von der Adresse in `DEF.fallback` herunter (standardmäßig das CDN Componentator). Autor: Peter Širka. Quelle: Componentator-Komponenten-Repository, MIT-Lizenz.

```html example.html
<ui-component name="notifybar"></ui-component>

Lorem ipsum dolor sit amet, consectetur adipisicing elit. Quia harum accusamus debitis aut sunt, deserunt magni alias neque unde reprehenderit ipsa ea laboriosam eveniet! Distinctio pariatur sed, a aut nobis.

<script>
	setTimeout(function() {
		SETTER('notifybar/success', 'Lorem ipsum dolor sit amet.');
	}, 1000);

	setTimeout(function() {
		SETTER('notifybar/warning', 'Lorem ipsum dolor sit amet.');
	}, 2000);
</script>
```
