# j-NotifyBar

> j-NotifyBar: singleton; messaggio di successo SETTER ('notifybar/success', 'MESSAGE')

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

- singolo
- Messaggio di successo `SETTER('notifybar/success', 'MESSAGE')`
- Messaggio di avvertimento `SETTER('notifybar/warning', 'MESSAGE')`
- Il messaggio di `SETTER('notifybar/info', 'MESSAGE', '[BUTTON_LABEL]', [callback_dismiss])`


__Configurazione__:

- `timeout` {Numero} Un tempo in millisecondi (default: `4000`)

__Metodi__:

- `component.success(message)`, il messaggio di successo
- `component.warning(message)` aggiunge il messaggio di avvertimento
- `component.info(message)` aggiunge messaggio di informazione
- `component.hide()` nasconde il bar
- `component.show()` mostra l'ultimo messaggio

__Lavorare con l'aspettore__:

- Gli errori vengono trattati automaticamente

```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'));
```

Utilizzare con `<ui-component name="notifybar">`Quando il componente non è ancora caricato, jComponent Scarica il codice in prima utilizzazione dall'indirizzo `DEF.fallback` (Il Componentator La storia di Peter Širka.Fonte: il Componentator Ristorante dei componenti, licenza MIT.

```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>
```
