Skip to content

Instantly share code, notes, and snippets.

@knicholes
Created August 7, 2012 16:42
Show Gist options
  • Save knicholes/3287162 to your computer and use it in GitHub Desktop.
Save knicholes/3287162 to your computer and use it in GitHub Desktop.
Custom Event for Appcelerator Module
// #app.js
var tible = require('com.amit.tible');
tible.fireEvent("my_event",{});
// #ComModule.m
-(void)startup
{
// this method is called when the module is first loaded
// you *must* call the superclass
[super startup];
[[NSNotificationCenter defaultCenter] addObserver: self
selector:@selector(my_event:)
name:nil
object:nil];
NSLog(@"[INFO] %@ loaded",self);
}
- (void)my_event:(NSNotification *)aNotification{
//NSMutableDictionary *event = [ NSMutableDictionary dictionary];
//[self fireEvent:@"my_event" withObject: event];
NSLog(@"In my_event in ObjC. Notified by: %@", aNotification);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment