Created
August 7, 2012 16:42
-
-
Save knicholes/3287162 to your computer and use it in GitHub Desktop.
Custom Event for Appcelerator Module
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// #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