//
//  NGListener.m
//  event_listener
//
//  Created by Giang Le Ngoc on 9/10/16.
//  Copyright © 2016 Facebook. All rights reserved.
//

#import <UIKit/UIKit.h>
#import "NGListener.h"

@implementation NGListener

RCT_EXPORT_MODULE();

+ (id)allocWithZone:(NSZone *)zone {
	static NGListener *sharedInstance = nil;
	static dispatch_once_t onceToken;
	dispatch_once(&onceToken, ^{
		sharedInstance = [super allocWithZone:zone];
	});
	return sharedInstance;
}

- (dispatch_queue_t)methodQueue {
	return dispatch_get_main_queue();
}

- (NSArray<NSString*> *)supportedEvents {
  return @[@"GeoUniqGeofenceUpdate"];
}

- (void)sendGeofenceWithName:(NSString*)name body:(NSDictionary*)body {
	dispatch_after(dispatch_time(DISPATCH_TIME_NOW, 5 * NSEC_PER_SEC), dispatch_get_main_queue(), ^{
		[self sendEventWithName:name body:body];
	});
}

@end
