ForgeComponenten
nl

Componenten

j-NotifyBar

jComponent 20 · jcomponent@20 component Voorbeeld geladen met jComponent 20
  • Singleton
  • Succesbericht SETTER('notifybar/success', 'MESSAGE')
  • Waarschuwingsbericht SETTER('notifybar/warning', 'MESSAGE')
  • Informatie over SETTER('notifybar/info', 'MESSAGE', '[BUTTON_LABEL]', [callback_dismiss])

Configuratie:

  • timeout {Nummer} Een tijduitgang in milliseconden (default: 4000)

Methoden:

  • component.success(message) geeft succesbericht
  • component.warning(message) geeft waarschuwingsbericht
  • component.info(message) geeft informatie aan
  • component.hide() verbergt de bar
  • component.show() laat het laatste bericht zien

Werken met Aster:

  • De fouten worden automatisch verwerkt
// 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'));

Gebruik het met <ui-component name="notifybar">Wanneer de component nog niet is geladen, jComponent Download het op eerste gebruik van het adres in DEF.fallback (De Componentator Schrijver: Peter Širka. bron: de Componentator Componenten repository, MIT licentie.

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>