Broadcaster

Contents

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

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

联系我们?

If you're building a serious project, you can't afford to spend hours troubleshooting. Ionic's experts offer official maintenance, support, and integration help.

Contact Us Today!

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

ionic cordova plugin add cordova-plugin-broadcaster npm install @ionic-native/broadcaster
Ionic EE comes with fully supported and maintained plugins from the Ionic Team. Learn More or Contact Us
ionic enterprise register --key=YOURPRODUCTKEY npm install @ionic-enterprise/broadcaster

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

  • Android
  • iOS
  • Browser

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

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

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'));