This repository was archived by the owner on Apr 4, 2023. It is now read-only.
File tree Expand file tree Collapse file tree 2 files changed +38
-0
lines changed Expand file tree Collapse file tree 2 files changed +38
-0
lines changed Original file line number Diff line number Diff line change @@ -1483,6 +1483,41 @@ firebase.deleteFile = function (arg) {
14831483 } ) ;
14841484} ;
14851485
1486+ firebase . subscribeToTopic = function ( topicName ) {
1487+ return new Promise ( function ( resolve , reject ) {
1488+ try {
1489+
1490+ if ( firebase . instance === null ) {
1491+ reject ( "Can be run only after init" ) ;
1492+ return ;
1493+ }
1494+
1495+ com . google . firebase . messaging . FirebaseMessaging . getInstance ( ) . subscribeToTopic ( topicName ) ;
1496+
1497+ } catch ( ex ) {
1498+ console . log ( "Error in firebase.subscribeToTopic: " + ex ) ;
1499+ reject ( ex ) ;
1500+ }
1501+ } ) ;
1502+ } ;
1503+
1504+ firebase . unsubscribeToTopic = function ( topicName ) {
1505+ return new Promise ( function ( resolve , reject ) {
1506+ try {
1507+
1508+ if ( firebase . instance === null ) {
1509+ reject ( "Can be run only after init" ) ;
1510+ return ;
1511+ }
1512+
1513+ com . google . firebase . messaging . FirebaseMessaging . getInstance ( ) . unsubscribeToTopic ( topicName ) ;
1514+
1515+ } catch ( ex ) {
1516+ console . log ( "Error in firebase.unsubscribeToTopic: " + ex ) ;
1517+ reject ( ex ) ;
1518+ }
1519+ } ) ;
1520+ }
14861521/*
14871522firebase.sendCrashLog = function (arg) {
14881523 return new Promise(function (resolve, reject) {
Original file line number Diff line number Diff line change @@ -569,5 +569,8 @@ export function getDownloadUrl(options: GetDownloadUrlOptions): Promise<string>;
569569
570570export function deleteFile ( options : DeleteFileOptions ) : Promise < any > ;
571571
572+ export function subscribeToTopic ( topicName ) : Promise < any > ;
573+
574+ export function unsubscribeToTopic ( topicName ) : Promise < any > ;
572575// crash logging
573576// export function sendCrashLog(options: SendCrashLogOptions): Promise<any>;
You can’t perform that action at this time.
0 commit comments