ForgeKomponenty
cs

Komponenty

j-Notify

jComponent 20 · jcomponent@20 component Příklad načten s jComponent 20

Konfigurace:

  • timeout {Number} musí obsahovat časový limit (milisekundy) pro uplynutí doby oznámení (předvolené: 3000)
  • position {String} může být top, top left, top right (předvolené), bottom, bottom left a bottom right

Metody:

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

Práce s asetrem:

  • Chyby se řeší automaticky
// 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'));

Použijte ji s <ui-component name="notify">Pokud je součástka ještě nezačleněna, jComponent Stáhnout ji na první použití z adresy DEF.fallback a) The Componentator CDN dle předvolby. autor: Peter Širka. zdroj: Componentator Výrobce je autorizován, MIT licence.

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>