Broadcaster

Contents

This plugin adds exchanging events between native code and your app.

https://github.com/bsorrentino/cordova-broadcaster

Ionic 通信Broadcaster插件的安装(Installation)

ionic cordova plugin add cordova-plugin-broadcaster npm install @ionic-native/broadcaster

Ionic 通信Broadcaster插件支持的平台(Supported Platforms)

  • Android
  • iOS
  • Browser

Ionic 通信Broadcaster插件的用法(Usage)

import { Broadcaster } from '@ionic-native/broadcaster';

constructor(private broadcaster: Broadcaster) { }

...

// Listen to events from Native
this.broadcaster.addEventListener('eventName').subscribe((event) => console.log(event));

// Send event to Native
this.broadcaster.fireNativeEvent('eventName', {}).then(() => console.log('success'));