GithubHelp home page GithubHelp logo

insidem2m / cordova-plugin-app-event Goto Github PK

View Code? Open in Web Editor NEW

This project forked from katzer/cordova-plugin-app-event

0.0 5.0 0.0 19 KB

Cordova App-Event Plugin

License: Apache License 2.0

Objective-C 100.00%

cordova-plugin-app-event's Introduction

npm version

Cordova App-Event Plugin

The essential purpose of that plugin is to broadcast iOS-specific application events, so that 3rd party plugins can listen to them.

Its mainly used as an internal dependency for the LocalNotification and Badge plugin. But can be used by any other plugin also. Feel free to submit an PR to broadcast additional events.

As of right now its possible to add observers for these events:

Usage

1. Add and install the plugin as an dependency

Once you have added the plugin as an dependency you can add observers for them.

<!-- plugin.xml -->

<dependency id="cordova-plugin-app-event" />

2. Add the protocol to the plugin's interface

As first the plugin needs to indicate interest to receivce app events by adding the APPAppEventDelegate protocol.

Note: Required for version 1.2.0 or newer!

// MyCordovaPlugin.h

#import "APPAppEventDelegate.h"
#import <Cordova/CDVPlugin.h>

@interface APPLocalNotification : CDVPlugin <APPAppEventDelegate>

@implementation MyCordovaPlugin

...

@end

3. Add implementations for the delegated events

To add an observer you need to implement the UIApplicationDelegate Protocol. Implementations from your AppDelegate class don't get overwritten!

For the didReceiveLocalNotification event you would need to add that method.

// MyCordovaPlugin.m

@implementation MyCordovaPlugin

- (void) didReceiveLocalNotification:(NSNotification*)localNotification
{
    ...
}

@end

Contributing

  1. Fork it
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create new Pull Request

License

This software is released under the Apache 2.0 License.

© 2013-2016 appPlant UG, Inc. All rights reserved

cordova-plugin-app-event's People

Contributors

katzer avatar mircoba avatar zfoltin avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.