j-NotifyBar
- singleton
- mensaje de éxito
SETTER('notifybar/success', 'MESSAGE') - mensaje de advertencia
SETTER('notifybar/warning', 'MESSAGE') - mensaje informativo
SETTER('notifybar/info', 'MESSAGE', '[BUTTON_LABEL]', [callback_dismiss])
Configuración:
timeout{Número} Un tiempo de espera en milisegundos (predeterminado:4000)
Métodos:
component.success(message)agrega mensaje de éxitocomponent.warning(message)agrega un mensaje de advertenciacomponent.info(message)agrega mensaje de informacióncomponent.hide()oculta la barracomponent.show()muestra el último mensaje
Funciona con ASETTER:
- los errores se manejan automáticamente
// 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'));Úselo con <ui-component name="notifybar">. Cuando el componente aún no está cargado, jComponent lo descarga en el primer uso desde la dirección en DEF.fallback (el CDN Componentator de forma predeterminada). Autor: Peter Širka. Fuente: repositorio de componentes Componentator, licencia MIT.
<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>