All Projects → ali-master → Pwa Badge

ali-master / Pwa Badge

Licence: mit
Badging for PWA app icons, Like Native Apps

Programming Languages

javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to Pwa Badge

Fuel Price
⛽ Check fuel prices daily in most of the states in India
Stars: ✭ 20 (-74.36%)
Mutual labels:  pwa-apps, pwa, progressive-web-app
Vue Pwa Asset Generator
PWA asset generator perfect with VueJS framework (but useful for all PWA!)
Stars: ✭ 97 (+24.36%)
Mutual labels:  icon, pwa, progressive-web-app
Yesplaymusic
高颜值的第三方网易云播放器,支持 Windows / macOS / Linux
Stars: ✭ 12,981 (+16542.31%)
Mutual labels:  pwa-apps, pwa, progressive-web-app
Pwa Asset Generator
Automates PWA asset generation and image declaration. Automatically generates icon and splash screen images, favicons and mstile images. Updates manifest.json and index.html files with the generated images according to Web App Manifest specs and Apple Human Interface guidelines.
Stars: ✭ 1,787 (+2191.03%)
Mutual labels:  icon, pwa, progressive-web-app
Detoxify App
📱🙅 Generate a fake app to replace any addictive app
Stars: ✭ 122 (+56.41%)
Mutual labels:  pwa-apps, pwa, progressive-web-app
Deckdeckgo
The web open source editor for presentations
Stars: ✭ 1,117 (+1332.05%)
Mutual labels:  pwa-apps, pwa, progressive-web-app
Qr Code Scanner
📠 A simple, fast and useful progressive web application
Stars: ✭ 982 (+1158.97%)
Mutual labels:  pwa-apps, pwa, progressive-web-app
Ionic Stencil Hn App
Ionic Stencil HackerNews App
Stars: ✭ 105 (+34.62%)
Mutual labels:  pwa-apps, pwa, progressive-web-app
Opennote
OpenNote was built to be an open web-based alternative to Microsoft OneNote (T) and EverNote.
Stars: ✭ 1,489 (+1808.97%)
Mutual labels:  pwa-apps, pwa, progressive-web-app
wordpress
Free PWA & SPA for Wordpress & Woocommerce
Stars: ✭ 103 (+32.05%)
Mutual labels:  pwa, progressive-web-app, pwa-apps
Vue Wordpress Pwa
An offline-first SPA using Vue.js, the WordPress REST API and Progressive Web Apps
Stars: ✭ 665 (+752.56%)
Mutual labels:  pwa-apps, pwa, progressive-web-app
Slidecontrol
Slidecontrol enables you to control your slides with your phone 📱
Stars: ✭ 30 (-61.54%)
Mutual labels:  pwa, progressive-web-app
Alumna
[Alpha release of v3] Development platform for humans / Plataforma de desenvolvimento para humanos
Stars: ✭ 32 (-58.97%)
Mutual labels:  pwa, progressive-web-app
Hellobooks
A Single-Page Library Management App built with nodejs, express and react and redux
Stars: ✭ 37 (-52.56%)
Mutual labels:  pwa, progressive-web-app
Flutter Cinema
Learn to create flutter app with BLoC Architecture
Stars: ✭ 26 (-66.67%)
Mutual labels:  pwa-apps, pwa
Sort Visualizer
This is a web app built to visualize classic sorting algorithms such as insertion sort, merge sort, quick sort, heap sort, etc. The entire app is built with only React; no other third-party JS or CSS library has been used.
Stars: ✭ 41 (-47.44%)
Mutual labels:  pwa, progressive-web-app
Pushkit
All the required components to set up independent web push notifications 🎈
Stars: ✭ 45 (-42.31%)
Mutual labels:  pwa, progressive-web-app
Demo Progressive Web App
🎉 A demo for progressive web application with features like offline, push notifications, background sync etc,
Stars: ✭ 798 (+923.08%)
Mutual labels:  pwa, progressive-web-app
Blog Pwa
An experiment in mixing Hugo, lit-element, and Polymer PRPL into a progressive web app blog.
Stars: ✭ 41 (-47.44%)
Mutual labels:  pwa, progressive-web-app
Pwa Workshop Angular Firebase
Build a production ready PWA with Angular and Firebase! This workshop consists of multiple steps for producing a PWA by transforming a regular web app - Ionic Conference App into a PWA, finally deploying it to Firebase.
Stars: ✭ 45 (-42.31%)
Mutual labels:  pwa, progressive-web-app

PWA Badge

Like Native Apps, The PWA Badge API allows installed web apps to set an application-wide badge on the app icon.

Travis CI codecov CodeFactor GitHub license PRs Welcome All Contributors


The App Badge API allows installed web apps to set an application-wide badge, shown in an operating-system-specific place associated with the application (such as the shelf or home screen).

Badges tend to be more user-friendly than notifications and can be updated with a much higher frequency since they don't interrupt the user. And, because they don't interrupt the user, they don't need the user's permission.

Keep in mind that to display the Badge count, Your PWA application should be installed on your Device.

Possible use cases

Examples of sites that may use this Library includes:

  • Chat, email, and social apps, to signal that new messages have arrived, or to show the number of unread items.
  • Productivity apps, to signal that a long-running background task (such as rendering an image or video) has completed.
  • Games, to signal that a player action is required (e.g., in Chess, when it is the player's turn).

Usage

npm install --save pwa-badge

The Badge API consists of five methods:

  • isSupported() Check if the User's browser supports the Feature, and returns a boolean value that represents the Status of supporting.
  • syncSetBadge(unreadCount) Removes app's badge Synchronously. If a value is provided, set the badge to the provided value otherwise, display a plain white dot (or other flag as appropriate to the platform). Setting number to 0 is the same as calling syncClearBadge() or asyncClearBadge().
  • syncClearBadge() Removes app's badge Synchronously.
  • asyncSetBadge(unreadCount) This API is the same as syncSetBadge() but returns an empty Promise for error handling.
  • asyncClearBadge() Removes app's badge Asynchronously and returns an empty Promise for error handling.

Check Browser supports the Badge API

TL;DR isSupported() method function is an util for informing your users that this feature supports by their Browser or OS and the pwa-badge library set and clear the Badge count safely, and you can avoid using isSupported() before calling the set or clear methods.

import PWABadge from 'pwa-badge';

// Create an Instance
const badge = new PWABadge();

if (badge.isSupported()) {
  // Hoora!, Supports the Badge feature
} else {
  // Does not supports
}

Sync Set and Clear Badge

import PWABadge from 'pwa-badge';

// Create an Instance
const badge = new PWABadge();

// Set Badge unreadCount
badge.syncSetBadge(1);

// Clear Badge unreadCount
badge.syncClearBadge();

Result by calling syncSetBadge:

Async Set and Clear Badge

asyncSetBadge() and asyncClearBadge() return empty promises you can use for error handling.

import PWABadge from 'pwa-badge';

// Create an Instance
const badge = new PWABadge();

// Set Badge unreadCount
badge
  .asyncSetBadge(1)
  .then(() => {
    // Badge count has shown as well
  })
  .catch((e) => {
    // The Browser not supporting the Badge feature or something went wrong
  });

// Clear Badge unreadCount
badge
  .asyncClearBadge()
  .then(() => {
    // Badge count has disappeared
  })
  .catch((e) => {
    // The Browser not supporting the Badge feature or something went wrong
  });

The App Badge API works on Windows, and macOS, in Chrome 81 or later. It has also been confirmed to work on Edge 84 or later. Support for Chrome OS is in development and will be available in a future release of Chrome. On Android, the Badge API is not supported. Instead, Android automatically shows a badge on app icon for the installed web app when there is an unread notification, just as for Android apps.

Some user agents may take a number like 4000 and rewrite it as 99+. If you saturate the badge yourself (for example by setting it to 99) then the + won't appear. No matter the actual number, just call syncSetBadge() or asyncSetBadge() and let the user agent deal with displaying it accordingly.

While the App Badge API in Chrome requires an installed app as I wrote before, you shouldn't make calls to the Badge API dependent on the installation state. Just call the API when it exists and installed on a device, as other browsers may show the badge in other places. If it works, it works. If not, it simply doesn't.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].