Skip to content

Instantly share code, notes, and snippets.

@dratwas
Created November 20, 2017 12:05
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dratwas/520e213adbfbd446876d5fdc73fcd452 to your computer and use it in GitHub Desktop.
Save dratwas/520e213adbfbd446876d5fdc73fcd452 to your computer and use it in GitHub Desktop.
@implementation CalendarManager
{
bool hasListeners;
}
// Will be called when this module's first listener is added.
-(void)startObserving {
hasListeners = YES;
}
// Will be called when this module's last listener is removed, or on dealloc.
-(void)stopObserving {
hasListeners = NO;
}
- (void)sendEvent {
if (hasListeners) {
[self sendEventWithName:@"SomeEvent" body:@{@"body": someBody}];
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment