ForgeComponentes
pt

Componentes

j-NotifyBar

jComponent 20 · jcomponent@20 component Exemplo carregado com jComponent 20
  • Singularidade
  • Mensagem de sucesso SETTER('notifybar/success', 'MESSAGE')
  • Mensagem de alerta SETTER('notifybar/warning', 'MESSAGE')
  • Informação SETTER('notifybar/info', 'MESSAGE', '[BUTTON_LABEL]', [callback_dismiss])

Configuração:

  • timeout {Número} Um tempo em milisecundos (default: 4000)

Métodos:

  • component.success(message) é uma mensagem de sucesso
  • component.warning(message) adiciona mensagem de alerta
  • component.info(message) adiciona mensagem de informação
  • component.hide() esconde o bar
  • component.show() mostra a última mensagem

Trabalhando com o ASETTER:

  • Os erros são tratados automaticamente
// 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'));

Use-o com <ui-component name="notifybar">Quando o componente ainda não está carregado, jComponent Descarrega-o no primeiro uso do endereço DEF.fallback (a partir do Componentator CDN por padrão). autor: Peter Širka. fonte: o Componentator Reserva de componentes, licença MIT.

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>