# j-NotifyBar

> j-NotifyBar: singleton; framgångsrik meddelande SETTER ('notifybar/success', 'MESSAGE')

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

- singlar
- Framgångsrik `SETTER('notifybar/success', 'MESSAGE')`
- Varning meddelande `SETTER('notifybar/warning', 'MESSAGE')`
- Information om `SETTER('notifybar/info', 'MESSAGE', '[BUTTON_LABEL]', [callback_dismiss])`


__Konfigurera__:

- `timeout` {Numret} En timout i millisekunder (default: `4000`)

__Metoder__:

- `component.success(message)` skickar framgångsrik meddelande
- `component.warning(message)` skickar ett varningsmeddelande
- `component.info(message)` skickar information
- `component.hide()` döljer baren
- `component.show()` visar sista meddelandet

__Arbetar med asetter__:

- Fel hanteras automatiskt

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

Använd den med `<ui-component name="notifybar">`När komponenten ännu inte är laddad, jComponent Ladda ner den första gången från adressen i `DEF.fallback` (en av Componentator Författare: Peter Širka. källa: The Componentator Komponenterna i lager, MIT licens.

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