npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@zum-front-end/web-push

v0.0.34

Published

줌 포털 알람 모듈

Downloads

41

Readme

Web Push

줌 포털 알람 모듈

FCM 관련 firebase 공식문서 https://firebase.google.com/docs/cloud-messaging/js/client

참고 기획서 링크 https://docs.google.com/presentation/d/1yMPaH36AyIYc3u_2bsDbMCodth-1l0EiQUxunWVF6oQ/edit#slide=id.g1211f86e692_2_59

Requirement

  • Firebase zum-app 권한 필요 (firebase console)
    • firebase config options
    • vapid key
    • firebase-messaging-sw.js

firebase-messaging-sw.js

푸시 알람을 붙이고자하는 프로젝트에 해당 파일을 생성 후 public 폴더에 추가

import { ZumWebPush } from '@zum-front-core/web-push';

const firebaseConfig = {
  // ...config options
};

ZumWebPush.onBackgroundMessage({ firebaseConfig });

Foreground Message (브라우저 창이 열려있을 때 알람)

사용법

onForegroundMessage 옵션

// FCM 사용을 위한 firebase console 계정 config
firebaseConfig
vapidKey
projectName = 'zum-app'
appType = 'web'

// 알람을 받는 로그인 사용자 아이디 (비로그인 = guest)
userId = 'guest'
        
/* 
 * 모두 기본동작이 정의되어 있어서 따로 만들어주지 않아도 되지만 특정 동작을 원하는 경우 오버라이드 가능 
 * */
onMessageHandler // Notification 알람 
onPermissionDenied // Notification API 권한 거절
onPermissionError // Notification API 에러
onPermissionGranted // Notification API 권한 수락
import { ZumWebPush } from '@zum-front-core/web-push';

const firebaseConfig = {
  // ...options
};

const vapidKey = '...'

ZumWebPush.onForegroundMessage({ firebaseConfig, vapidKey });

Background Message (브라우저 창이 꺼져있을 때 서비스 워커를 사용한 알람)

기본적으로 FCM (firebase cloud message)에서 백그라운드와 관련된 알람을 내부에서 처리해주기 때문에 원하는 동작을 위해서는 service worker file이 필요

사용법

onBackgroundMessage 옵션

// FCM 사용을 위한 firebase console 계정 config
firebaseConfig
// firebase-messaging-sw.js
import { ZumWebPush } from '@zum-front-core/web-push';

ZumWebPush.onBackgroundMessage({ firebaseConfig });