# j-Message

> j-Message: singleton; łatwa w użyciu

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

- Singleton
__Konfiguracja__:

- `button {String}` etykieta przycisków (default: `OK`)
- `style {Number}` może zmienić styl (default: `1`), styl `2` jest podobny do komponentu `j-Approve`
- `closeoutside {Boolean}` umożliwia zamknięcie pola wiadomości, klikając poza głównym przyciskiem

__Używanie__:

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

__Praca z asystentem__:

- Błędy są automatycznie popełnione

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

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

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

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

Użyj go z `<ui-component name="message">`Gdy element nie jest jeszcze ładowany, jComponent Pobierz go po pierwszym użyciu z adresu `DEF.fallback` (Wydaje się Componentator Autor: Peter Širka Źródło: Componentator Zestaw składników, licencja MIT.

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

<script>
	setTimeout(function() {
		SETTER('message/success', 'Success message');
		// SETTER('message/warning', 'Warning message');
	}, 2000);
</script>
```
