//
//  RNHkVideoModule.m
//  RNHkVideo
//
//  Created by wangjun on 2020/12/9.
//  Copyright © 2020 Facebook. All rights reserved.
//

// CalendarManager.m
#import "RNHkVideoModule.h"

@implementation RNHkVideoModule


static RNHkVideoModule* _instance = nil;
 

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

//+(instancetype) shareInstance
//{
//    static dispatch_once_t onceToken ;
//    dispatch_once(&onceToken, ^{
//        _instance = [[self alloc] init] ;
//    }) ;
//    
//    return _instance ;
//
//}
RCT_EXPORT_MODULE();

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

- (void)sendEvent:(NSString *)eventName status:(NSString *)status errorMsg:(NSString *)errorMsg
{
    dispatch_async(dispatch_get_main_queue(), ^{
    NSLog(@"sendEvent");
    [self sendEventWithName:@"playerStatusChange" body:@{
                                                      @"eventName":eventName,
                                                      @"status":status,
                                                      @"errorMsg":errorMsg,
                                                      }];
  });
}

@end
