Web Component: j-Notify


  • Info
  • HTML
  • JS
  • CSS
  • Meta

j-Notify

  • easy usage
  • singleton

Configuration:

  • timeout {Number} has to contain a timeout (milliseconds) for the expiration of notification (default: 3000)
  • position {String} can be top, top left, top right (default), bottom , bottom left and bottom right

Methods:

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

Works with ASETTER:

  • errors are handled automatically
// 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'));

Author