Quantcast
Channel: Ionic Forum - Latest topics
Viewing all articles
Browse latest Browse all 71531

Observe Cordova Network Connection Events with rxjs

$
0
0

@divramod wrote:

is it somehow possible to make an rxjs observable with the fromEvent method out of the cordova network connection plugin.

i am trying that with ionic 2.

i can see, that there are two events (online/offline) in the cordova network connection plugin. but how to hook into them with rxjs?

something that looks like that:

const offline$ = Observable.fromEvent(CORDOVA_OFFLINE_EVENT);
offline$.subscribe(
    function (connectionType) {
        console.log("connectionType", JSON.stringify(connectionType));
    },
    function (err) {
        console.log('Error: ' + err);
    },
    function () {
        console.log('Completed');
    }
);

i also created a stackoverflow question

Posts: 1

Participants: 1

Read full topic


Viewing all articles
Browse latest Browse all 71531

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>