34 lines
546 B
Objective-C
34 lines
546 B
Objective-C
//
|
|
// MyEventBus.h
|
|
// nochange
|
|
//
|
|
// Created by mac on 2024/7/30.
|
|
//
|
|
|
|
#ifndef MyEventBus_h
|
|
#define MyEventBus_h
|
|
|
|
#import <Foundation/Foundation.h>
|
|
|
|
typedef struct {
|
|
NSString *name;
|
|
NSDictionary *data;
|
|
} EventMessage;
|
|
|
|
typedef void (^SubscriberCallback) (EventMessage *msg);
|
|
|
|
@interface MyEventBus : NSObject
|
|
{
|
|
|
|
}
|
|
|
|
+ (instancetype)sharedInstance;
|
|
|
|
- (void)registerSubscriber:(id)subscriber;
|
|
- (void)unregisterSubscriber:(id)subscriber;
|
|
- (void)postEvent:(NSString *)eventName withObject:(id)object;
|
|
|
|
@end
|
|
|
|
#endif /* MyEventBus_h */
|