Skip to content
This repository has been archived by the owner on Nov 11, 2020. It is now read-only.

Frettman/vaadin-web-notifications

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Web Notifications Add-on for Vaadin 8

This is a Vaadin extension to support the (Web) Notifications API. This allows you to show notifications directly on the user's desktop, regardless of whether browser or browser tab are currently visible.

There are two competing specifications for this API: one from the WHATWG and one from the W3C. They share features, but there are differences. And differing browser support on different platforms makes the situation even more complicated. That's an abyss that I didn't want to fully explore.

If you just want to show notifications without getting down to the nitty-gritty of browser support, the following options should be rather safe to use - at least in desktop browsers:

  • body(String)
  • icon(String)
  • tag(String)
  • onClick(Runnable)
  • onError(Runnable)
  • timeout(Integer)
  • closeOnClick(boolean)

This extension needs to be attached to a UI and needs to request the user's permission to show notifications. However all that is taken care of automatically.

Uses notify.js by Alex Gibson.

Example

WebNotifications.create("Title")
  .body("Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Aliquam hendrerit mi posuere lectus. Vestibulum enim wisi, viverra nec, fringilla in, laoreet vitae, risus.")
  .icon("theme://img/logo.png").tag("sometag")
  .onClick(() -> Notification.show("onClick")).show());

Download release

Official releases of this add-on are available at Vaadin Directory. For Maven instructions, download and reviews, go to http://vaadin.com/addon/web-notifications-add-on-for-vaadin-8

License

Add-on is distributed under MIT License. For license terms, see LICENSE.txt.

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Packages

No packages published