# j-Notify

> j-Notify: Fehler werden automatisch behandelt

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

__Konfiguration__:

- `timeout {Number}` muss ein Timeout (Millisekunden) für den Ablauf der Benachrichtigung enthalten (Standard: `3000`)
- `position {String}` kann `top`, `top left`, `top right` (Standard), `bottom`, `bottom left` und `bottom right` sein

__Methoden__:

```js
SETTER('notify/warning', 'Some warning');
SETTER('notify/success', 'Some success message');
SETTER('notify/info', 'Some info message');
```

__Funktioniert mit ASETTER__:

- Fehler werden automatisch behandelt

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

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

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

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

Verwenden Sie es mit `<ui-component name="notify">`. 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
<style>
	body { font-family: Arial; background-color: #F5F5F5; }
</style>

<ui-component name="notify"></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('notify/success', 'This is "success" message.');
	}, 1000);

	setTimeout(function() {
		SETTER('notify/warning', 'This is "warning" message.', 2);
	}, 2000);

	setTimeout(function() {
		SETTER('notify/info', 'This is "info" message.', 3);
	}, 3000);
</script>
```
