//
//  BJNotification.h
//  demo
//
//  Created by WangXu on 15/10/26.
//  Copyright (c) 2015骞?beijiahiddink. All rights reserved.
//

#import <Foundation/Foundation.h>

@interface BJNotification : NSObject


@property (nonatomic, copy) NSString *name;
@property (nonatomic, strong) id object;
@property (nonatomic, copy) NSDictionary *userInfo;

/**
 *  鍒濆鍖栭€氱煡浣撳疄渚嬩究鍒╂瀯閫犲櫒
 *
 *  @param aName    閫氱煡鍚嶅瓧
 *  @param anObject anObject
 *
 *  @return 閫氱煡浣撳疄渚? */
+ (instancetype)notificationWithName:(NSString *)aName
                              object:(id)anObject;

/**
 *  鍒濆鍖栭€氱煡浣撳疄渚嬩究鍒╂瀯閫犲櫒
 *
 *  @param aName    閫氱煡鍚嶅瓧
 *  @param anObject anObject
 *  @param aUserInfo aUserInfo
 *
 *  @return 閫氱煡浣撳疄渚? */
+ (instancetype)notificationWithName:(NSString *)aName
                              object:(id)anObject
                            userInfo:(NSDictionary *)aUserInfo;

/**
 *  鍒濆鍖栭€氱煡浣撳疄渚? *
 *  @param name     閫氱煡鍚嶅瓧
 *  @param object   object
 *  @param userInfo userInfo
 *
 *  @return  閫氱煡浣撳疄渚? */
- (instancetype)initWithName:(NSString *)name
                      object:(id)object
                    userInfo:(NSDictionary *)userInfo;

@end


@interface BJNotificationCenter : NSObject

/**
 *  鍒涘缓閫氱煡涓績鏈嶅姟
 *
 *  @return 杩斿洖閫氱煡涓績瀹炰緥
 */
+ (BJNotificationCenter *)defaultCenter;

/**
 *  娉ㄥ唽閫氱煡
 *
 *  @param observer  娉ㄥ唽鑰? *  @param aSelector 娉ㄥ唽鍝嶅簲鏂规硶
 *  @param aName     閫氱煡鍚嶅瓧
 *  @param anObject  anObject
 */
- (void)addObserver:(id)observer
           selector:(SEL)aSelector
               name:(NSString *)aName
             object:(id)anObject;

/**
 *  鍙戦€侀€氱煡
 *
 *  @param notification 閫氱煡浣撶被鍨? */
- (void)postNotification:(BJNotification *)notification;

/**
 *  鍙戦€侀€氱煡
 *
 *  @param aName    閫氱煡鍚嶅瓧
 *  @param anObject anObject
 */
- (void)postNotificationName:(NSString *)aName
                      object:(id)anObject;

/**
 *  鍒犻櫎娉ㄥ唽鑰? *
 *  @param observer 娉ㄥ唽鑰? */
- (void)removeObserver:(id)observer;

/**
 *  鍒犻櫎娉ㄥ唽鑰? *
 *  @param observer 娉ㄥ唽鑰? *  @param aName    閫氱煡鍚嶅瓧
 *  @param anObject anObject
 */
- (void)removeObserver:(id)observer
                  name:(NSString *)aName
                object:(id)anObject;

@end
// 鐗堟潈灞炰簬鍘熶綔鑰?// http://code4app.com (cn) http://code4app.net (en)
// 鍙戝竷浠g爜浜庢渶涓撲笟鐨勬簮鐮佸垎浜綉绔? Code4App.com